[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.16 LALR(1) Parsing
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 in Bison, The Yacc-compatible Parser Generator). Parsers are defined using the
lalr-parser
macro.
- Scheme Syntax: lalr-parser [options] tokens rules...
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.
This document was generated on April 20, 2013 using texi2html 5.0.