lean-ja / lean-ja/lean-by-example
数式のパーサー実装例 / mutual 使用例
Open
Nobody has claimed this yet.
コード例
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
import ProgrammingHaskell.Chapter13.Section7
open Parser
mutual
partial def expr : Parser Nat := do
let t ← term
let tail : Parser Nat := do
let _ ← symbol "+"
let e ← expr
return t + e
tail <|> return t
partial def term : Parser Nat := do
let f ← factor
let tail : Parser Nat := do
let _ ← symbol "*"
let t ← term
return f * t
tail <|> return f
partial def factor : Parser Nat := do
let first : Parser Nat := do
let _ ← symbol "("
let e ← expr
let _ ← symbol ")"
return e
first <|> natural
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the issue's Lean snippet and the imported ProgrammingHaskell.Chapter13.Section7 module first. The issue does not identify a documentation file, test, or specific change, so confirm the intended location and expected form of the mutual parser example before work begins.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100