Creates a parsing function of the given name for the grammar defined.
parsergen
defparser name-and-options {rule}* => parsing-function
name-and-options ::= name | (name [[option]])
option ::= :accept-without-eoi-p accept-without-eoi-p
rule ::= normal-rule | error-rule | combined-rule
normal-rule ::= ((non-terminal {grammar-symbol}*) {form}*)
error-rule ::= ((non-terminal :error) {form}*)
combined-rule ::= (non-terminal {combined-rule-clause}*)
combined-rule-clause ::= (combined-rule-lhs {form}*)
combined-rule-lhs ::= ({grammar-symbol}*) | (:error)
grammar-symbol ::= token | non-terminal
name⇩ |
The name of the parser. |
accept-without-eoi-p⇩ |
A generalized boolean. |
non-terminal⇩ |
A symbol. |
form⇩ |
A Lisp form. |
token⇩ |
A grammar token as returned by the lexer. |
parsing-function |
The symbol naming the parsing function. |
The macro defparser
creates a parsing function named name for the grammar defined. The parsing function is defined as if by:
(defun name (lexer &optional (symbol-to-string #'identity) &key (message-stream t) return-match-tree-p) ...)
See 21.3 Functions defined by defparser for a description of the arguments and the result of the function named name.
The rules define the productions of the grammar and the associated forms define the semantic actions for the rules.
When accept-without-eoi-p is true, the parser accepts the input as soon as the top level rule matches completely rather than waiting for end of input (eoi). The default value of accept-without-eoi-p is false.
For a full description or token, non-terminal, grammar-symbol and form and examples, see 21 The Parser Generator.
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:55