Mention `(system base lalr)' in the manual.
[bpt/guile.git] / doc / ref / api-lalr.texi
CommitLineData
2115b8eb
LC
1@c -*-texinfo-*-
2@c This is part of the GNU Guile Reference Manual.
3@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2009, 2010
4@c Free Software Foundation, Inc.
5@c See the file guile.texi for copying conditions.
6
7@page
8@node LALR(1) Parsing
9@section LALR(1) Parsing
10
11The @code{(system base lalr)} module provides the
12@uref{http://code.google.com/p/lalr-scm/, @code{lalr-scm} LALR(1) parser
13generator by Dominique Boucher}. @code{lalr-scm} uses the same algorithm as GNU
14Bison (@pxref{Introduction, Introduction to Bison,, bison, Bison@comma{} The
15Yacc-compatible Parser Generator}). Parsers are defined using the
16@code{lalr-parser} macro.
17
18@deffn {Scheme Syntax} lalr-parser [@var{options}] @var{tokens} @var{rules}...
19Generate an LALR(1) syntax analyzer. @var{tokens} is a list of symbols
20representing the terminal symbols of the grammar. @var{rules} are the grammar
21production rules.
22
23Each rule has the form @code{(@var{non-terminal} (@var{rhs} ...) : @var{action}
24...)}, where @var{non-terminal} is the name of the rule, @var{rhs} are the
25right-hand sides, i.e., the production rule, and @var{action} is a semantic
26action associated with the rule.
27
28The generated parser is a two-argument procedure that takes a @dfn{tokenizer}
29and a @dfn{syntax error procedure}. The tokenizer should be a unary procedure
30taking a port and returning a lexical token as produced by
31@code{make-lexical-token}. The syntax error procedure may be called with at
32least an error message (a string), and optionally the lexical token that caused
33the error.
34@end deffn
35
36Please refer to the @code{lalr-scm} documentation for details.