lean-ja / lean-ja/lean-by-example
DSL をエラボレータで評価する/ elab 使用例
Open
Nobody has claimed this yet.
コード例
メタプログラミング
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
Zulip: > How to evaluate a DSL using the elaborator?
open Lean hiding Expr
open Qq
elab "⟦" x:term "⟧" : term => do
let e ← unsafe Elab.Term.evalTerm Expr q(Expr) x
match eval_closed e with
| .inr n => return q($n)
| .inl x => throwError "{x} occurs"
open Expr
#check ⟦ plus (num 3) (num 5) ⟧ -- this is elaborated to 8
#check ⟦ plus (num 3) (var "x") ⟧ -- this reports an error: "x occurs"
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
Begin with the linked Zulip discussion and the provided elaborator snippet. Find the repository location for comparable Lean-by-example entries and check how examples are organized and rendered. Done means the DSL evaluation example is added in the project’s established format and demonstrates both the successful evaluation and the variable error shown.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100