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.

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).
  • Location tracking with @L and @R (see e.g. this test).
  • Integrating with external tokenizers (see e.g. this test invoked from here).
  • Conditional macros (no good test to point you at yet, sorry)
  • Fallible action code that produces a Result (see e.g. this test invoked from here).
  • Converting to use LALR(1) instead of LR(1) (see e.g. this test invoked from here).
  • Plans for future features