All Manuals > LispWorks User Guide and Reference Manual > 17 The Parser Generator


17.3 Functions defined by defparser

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 .. )

defines the function

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 cl:identity .

defparser also defines functions corresponding to the individual actions of the parser.

Normal actions are named:

name -action index

and error actions are named:

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.

LispWorks User Guide and Reference Manual - 21 Dec 2011