Mention `(system base lalr)' in the manual.
authorLudovic Courtès <ludo@gnu.org>
Mon, 29 Mar 2010 23:11:09 +0000 (01:11 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 30 Mar 2010 22:42:00 +0000 (00:42 +0200)
* doc/ref/Makefile.am (guile_TEXINFOS): Add `api-lalr.texi'.

* doc/ref/api-lalr.texi: New file.

* doc/ref/guile.texi (API Reference): Include it.

doc/ref/Makefile.am
doc/ref/api-lalr.texi [new file with mode: 0644]
doc/ref/guile.texi

index 7ed92f2dad2a7abe20ad341b87488dcac1105e96..9188bcb430c1e3529c349dabf783acb084ccb7bc 100644 (file)
@@ -40,6 +40,7 @@ guile_TEXINFOS = preface.texi                 \
                 api-binding.texi               \
                 api-control.texi               \
                 api-io.texi                    \
+                api-lalr.texi                  \
                 api-evaluation.texi            \
                 api-memory.texi                \
                 api-modules.texi               \
diff --git a/doc/ref/api-lalr.texi b/doc/ref/api-lalr.texi
new file mode 100644 (file)
index 0000000..e19614c
--- /dev/null
@@ -0,0 +1,36 @@
+@c -*-texinfo-*-
+@c This is part of the GNU Guile Reference Manual.
+@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2009, 2010
+@c   Free Software Foundation, Inc.
+@c See the file guile.texi for copying conditions.
+
+@page
+@node LALR(1) Parsing
+@section LALR(1) Parsing
+
+The @code{(system base lalr)} module provides the
+@uref{http://code.google.com/p/lalr-scm/, @code{lalr-scm} LALR(1) parser
+generator by Dominique Boucher}.  @code{lalr-scm} uses the same algorithm as GNU
+Bison (@pxref{Introduction, Introduction to Bison,, bison, Bison@comma{} The
+Yacc-compatible Parser Generator}).  Parsers are defined using the
+@code{lalr-parser} macro.
+
+@deffn {Scheme Syntax} lalr-parser [@var{options}] @var{tokens} @var{rules}...
+Generate an LALR(1) syntax analyzer.  @var{tokens} is a list of symbols
+representing the terminal symbols of the grammar.  @var{rules} are the grammar
+production rules.
+
+Each rule has the form @code{(@var{non-terminal} (@var{rhs} ...) : @var{action}
+...)}, where @var{non-terminal} is the name of the rule, @var{rhs} are the
+right-hand sides, i.e., the production rule, and @var{action} is a semantic
+action associated with the rule.
+
+The generated parser is a two-argument procedure that takes a @dfn{tokenizer}
+and a @dfn{syntax error procedure}.  The tokenizer should be a unary procedure
+taking a port and returning a lexical token as produced by
+@code{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.
+@end deffn
+
+Please refer to the @code{lalr-scm} documentation for details.
index 2958968a9d216c6edec2e390d7a707e06014d76e..bb765456c4195f052daafd71c7061f3dabe60045 100644 (file)
@@ -301,6 +301,7 @@ available through both Scheme and C interfaces.
 * Binding Constructs::          Definitions and variable bindings.
 * Control Mechanisms::          Controlling the flow of program execution.
 * Input and Output::            Ports, reading and writing.
+* LALR(1) Parsing::             Generating LALR(1) parsers.            
 * Read/Load/Eval/Compile::      Reading and evaluating Scheme code.
 * Memory Management::           Memory management and garbage collection.
 * Objects::                     Low level object orientation support.
@@ -325,6 +326,7 @@ available through both Scheme and C interfaces.
 @include api-binding.texi
 @include api-control.texi
 @include api-io.texi
+@include api-lalr.texi
 @include api-evaluation.texi
 @include api-memory.texi
 @include api-modules.texi