mpg 0.0.0

Squatted crate for a Modern Parser Generator

Squatted crate for a Modern Parser Generator.

Contact @CAD97 if you want to collaborate on development of this tool. Solo development will happen when they find time and motivation concurrently.

Until then, check out tree-sitter.

Namely, inspired by matklad's post, mpg will provide


Tooling designed IDE-first.

  • Interactive development. Provide example inputs while editing the grammar and immediately see the resulting syntax trees.
  • Inline snapshot tests. Example productions listed next to the defining rules are automatically tested with the resulting syntax trees tracked in version control.
  • Full LSP support.


  • Designed to be used on top of a separate lexer.
  • Supports pull-lexing with principled lexical feedback.
  • Prefers pre-lexing with replayable incremental reparsing.
  • Produces a homogeneous literal syntax tree.
  • Provides an optional typed view of the literal syntax tree.
  • Embeddable anywhere via a C API.

Parsing Techniques

  • Specify operator precedence and associativity directly.
  • Strong error tolerance/recovery via follow sets and explicit recovery points.
  • Choose your tradeoffs:
    • Guaranteed determinism at a cost of generality.
    • Full generality at the cost of ambiguity.

Quality of incorrect syntax error messages is a non-priority left to the user.