The (system base lalr) module provides the
lalr-scm LALR(1) parser generator by Dominique Boucher. lalr-scm uses the same algorithm as GNU
Bison (see Introduction to Bison). Parsers are defined using the
lalr-parser macro.
Generate an LALR(1) syntax analyzer. tokens is a list of symbols representing the terminal symbols of the grammar. rules are the grammar production rules.
Each rule has the form
(non-terminal(rhs...) :action...), where non-terminal is the name of the rule, rhs are the right-hand sides, i.e., the production rule, and action is a semantic action associated with the rule.The generated parser is a two-argument procedure that takes a tokenizer and a syntax error procedure. The tokenizer should be a thunk that returns lexical tokens as produced by
make-lexical-token. The syntax error procedure may be called with at least an error message (a string), and optionally the lexical token that caused the error.
Please refer to the lalr-scm documentation for details.