LALRPOP Tutorial
This is a tutorial for how to write a complete parser for a simple calculator using LALRPOP.
If you are unfamiliar with what a parser generator is, you should read Crash course on parsers first.
- Adding LALRPOP to your project
- Parsing parenthesized numbers
- Type inference
- Handling full expressions
- Building ASTs
- Macros
- Fallible actions
- Error recovery
- Passing state parameter
This tutorial is still incomplete. There are a few example grammars in the doc section of the repository.
Here are some topics that I aim to cover when I get time to write about them:
- Advice for resolving shift-reduce and reduce-reduce conflicts
- Passing state and type/lifetime parameters to your action code (see e.g. this test invoked from here).
- Conditional macros (no good test to point you at yet, sorry)
- Converting to use
LALR(1)
instead ofLR(1)
(see e.g. this test invoked from here). - Plans for future features