NextPrevUpTopContentsIndex

16.3 Functions defined by defparser

The form (defparser name grammar ) defines two main functions. The function < name > is defined as the parsing function, and the function < name > -grammar is a parameterless function that returns the grammar, as presented to the parser generator. For example:

(defparser my-parser .. grammar .. )

defines the two functions:

(defun my-parser (lexer &optional 
                          (symbol-to-string #'identity))    ...)

and

(defun my-parser-grammar () ..)

The lexer parameter to the parser function specifies the lexical analyzer function to be used. The optional symbol-to-string function may be used to define a mapping from grammar symbols to strings for printing purposes. It defaults to the identity function.

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

Normal actions are named:

< parser-name >- action < index >

Error actions are named:

< parser-name >- error-action < index >

parser-name here is the name as given to defparser. 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 - 7 Jul 2004

NextPrevUpTopContentsIndex