lean-ja / lean-ja/lean-by-example

数式のパーサー実装例 / mutual 使用例

Open
#1,732 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.