[climacs-cvs] CVS update: climacs/Doc/climacs-internals.texi
Robert Strandh
rstrandh at common-lisp.net
Tue Mar 1 04:56:37 UTC 2005
Update of /project/climacs/cvsroot/climacs/Doc
In directory common-lisp.net:/tmp/cvs-serv24900/Doc
Modified Files:
climacs-internals.texi
Log Message:
Added section on incremental parsing.
Date: Tue Mar 1 05:56:29 2005
Author: rstrandh
Index: climacs/Doc/climacs-internals.texi
diff -u climacs/Doc/climacs-internals.texi:1.14 climacs/Doc/climacs-internals.texi:1.15
--- climacs/Doc/climacs-internals.texi:1.14 Sun Feb 27 20:13:47 2005
+++ climacs/Doc/climacs-internals.texi Tue Mar 1 05:56:27 2005
@@ -716,6 +716,91 @@
present, and it should be exploitable by several, potentially totally
different, display units.
+ at section Incremental parsing framework
+
+ at subsection Earley parser
+
+Climacs contains an incremental parser that uses the Earley
+algorithm. This algorithm accepts the full set of context-free
+grammars, allowing greater freedom for the developer to define natural
+grammars without having to think about restrictions such as LL(k) or
+LALR(k).
+
+Beware, though, that the Earley algorithm can be quite inefficient if
+the grammar is sufficiently complicated, in particular if the grammar
+is ambiguous.
+
+ at subsection Specifying a grammar
+
+An incremental parser is created from a grammar.
+
+ at deffn {Macro} {grammar} &body rules
+
+Create a grammar object from a set of rules
+ at end deffn
+
+ at deffn {Rule} {} symbol -> (&rest arguments) &optional body
+
+Each rule is a list of this form.
+ at end deffn
+
+ at noindent
+Here @var{symbol} is the target symbol of the rule, and should be the name of
+a CLOS class.
+
+ at deffn {Rule argument} {} (var type test)
+
+The most general form of a rule argument.
+ at end deffn
+
+ at noindent
+Here @var{var} is the name of a lexical variable. The scope of the
+variable contains the test, all the following arguments and the body
+of the rule. The @var{type} is a Common Lisp type specification. The
+rule applies only of the @var{type} of the object contain in var is of
+that type. The @var{test} contains arbitrary Common Lisp code for
+additional checks as to the applicability of the rule.
+
+ at deffn {Rule argument} {} (var type)
+
+Abbreviated form of a rule argument.
+ at end deffn
+
+ at noindent
+Here, @var{type} must be a symbol typically the name of a CLOS class.
+This form is an abbreviation for @code{(@var{var} @var{type} t)}.
+
+ at deffn {Rule argument} {} (var test)
+
+Abbreviated form of a rule argument.
+ at end deffn
+
+ at noindent
+Here, @var{test} must not be a symbol. This form is an abbreviation
+of @code{(@var{var} @var{var} @var{test})}, i.e., the name of the
+variable is also the name of a type, typically a CLOS class.
+
+ at deffn {Rule argument} {} var
+
+Abbreviated form of a rule argument.
+ at end deffn
+
+ at noindent
+This form is an abbreviation of @code{(@var{var} @var{var} t)}.
+
+The @var{body} of a rule, if present, contains an expression that should
+have an instance (not necessarily direct) of the class named by the
+symbol (the left-hand-side) of the rule. It is important that this
+restriction be respected, since the Earley algorithm will not work
+otherwise.
+
+If the @var{body} is absent, it is the same as if a body of the form
+ at code{(make-instance '@var{symbol})} had been given.
+
+The body can also be a sequence of forms, the first one of which
+must be a symbol. These forms typically contain initargs, and will be
+passed as additional arguments to @code{(make-instance '@var{symbol})}.
+
@section Common Lisp syntax
Technically, comments and such are not expressions, but it is OK for
More information about the Climacs-cvs
mailing list