The form
(defparser
name
grammar
)
defines a number of functions. The main function
name
is defined as the parsing function. For example:
(defparser my-parser .. grammar .. )
my-parser lexer &optional symbol-to-string =>
lexer
specifies the lexical analyzer function to be used. The optional argument
symbol-to-string
should be a function mapping grammar symbols to strings for printing purposes. The default value of
symbol-to-string
is the function
identity
.
defparser
also defines functions corresponding to the individual actions of the parser.
name
-action
index
name
-error-action
index
where
name
here is the name as given to
defparser
and
index
is the number of the rule or error rule in the grammar.
All function names are interned in the current package when
defparser
is called.