NextPrevUpTopContentsIndex

defparser

Macro
Summary

Creates a parsing function of the given name for the grammar defined.

Package

parsergen

Signature
defparser name
 {rule
}* => parsing-function
rule
 ::= normal-rule
 | error-rule
normal-rule
 ::= ((non-terminal
 {grammar-symbol
}*) {form
}*)
error-rule
 ::=  ((non-terminal
 :error) {form
}*)
Arguments

name

The name of the parser.

The rules define the productions of the grammar and the associated forms define the semantic actions for the rules.

Values

parsing-function

The symbol name of the parsing function.

Description

defparser creates a parsing function of the given name for the grammar defined. The parsing function is defined as if by:

(defun <name> (lexer &optional (symbol-to-string #'identify))

The lexer parameter is a function of no arguments that returns two values: the next grammar token on the input and the associated semantic value.

The optional symbol-to-string function can be used to define a printed representation of the grammar tokens. The function should take a grammar symbol as its single argument and returns an object to be used as a print representation for the grammar token.

For a full description and examples, see the LispWorks User Guide .

 


LispWorks Reference Manual - 23 Jul 2004

NextPrevUpTopContentsIndex