Local parsers
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
There are many scenarios we want to support where we need to update the parsing table while we are parsing.
Examples:
1- def + notation macro that allows us to define functions and notation simultaneously.
def (_++_) {a} : List a -> List a -> List a
| [], bs => bs
| a::as, bs => a :: (as ++ bs)
2- Recursive macros. The following macro definition works as expected
syntax "repeat " tactic : tactic
macro_rules
| `(repeat $tac) => `(tactic| ($tac; repeat $tac) <|> skip)
but, the following one does not
macro "repeat " x:tactic : tactic => `(($x; repeat $x) <|> skip)
The problem is that the syntax repeat x does not exist yet when we are parsing `(($x; repeat $x) <|> skip)
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
No files or tests are named. Start by locating the parser and macro-expansion entry points that maintain the parsing table, then use the two examples to determine how local updates and recursive macros should behave. Done means both examples parse and expand as described, with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100