LispWorks User Guide and Reference Manual > 17 The Parser Generator > 17.2 Grammar rules

NextPrevUpTopContentsIndex

17.2.1 Example

If a grammar contains the production:

expression -> expression operator expression

with a semantic representation of a list of the individual semantic values, the Lisp grammar would contain the rule:

(( expression expression operator expression ) (list $1 $2 $3))

Error productions of the form:

(( nt :error) ( some error behavior ))

are explained in the section below.

The first rule of the grammar should be of the form:

(( nt nt1) $1)

where the non-terminal nt has no other productions and nt1 serves as the main "top-level" non-terminal.


LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex