Crate rusty_lr

source ·
Expand description

§RustyLR

LR(1) and LALR(1) code generator in Rust

For sample and examples, please refer to the GitHub repository

§Features

  • pure Rust implementation
  • compile-time DFA construction from CFGs ( with proc-macro )
  • customizable reducing action
  • resolving conflicts of ambiguous grammar
  • tracing parser action with callback, also error handling
  • readable error messages, both for grammar building and parsing
§Why proc-macro, not external executable?
  • Decent built-in lexer, with consideration of unicode and comments.
  • Can generate pretty error messages, by just passing Span data.
  • With modern IDE, can see errors in real-time with specific location.

Macros§

  • build a lalr1 Deterministic Finite Automaton (DFA) parser at compile time
  • build a lalr1 Deterministic Finite Automaton (DFA) parser at runtime
  • build a lr1 Deterministic Finite Automaton (DFA) parser at compile time
  • build a lr1 Deterministic Finite Automaton (DFA) parser at runtime

Structs§

Enums§

  • Error type for grammar.build()
  • Error type for feed()
  • for resolving shift/reduce conflict
  • Token represents a terminal or non-terminal symbol in the grammar.

Traits§

  • callback trait for tracing parser actions