Precedence Parsing Overview
---------------------------
This package offers improvements over previous parsers.
* Common computer language constructs are concisely specified.
* Grammars can be changed dynamically. Operators can be assigned
different meanings within a lexical context.
* Rulesets don't need compilation. Grammars can be changed
incrementally.
* Operator precedence is specified by integers.
* All possibilities of bad input are handled (1) and return as much
structure as was parsed when the error occured; The symbol `?' is
substituted for missing input.
Here are the higher-level syntax types and an example of each.
Precedence considerations are omitted for clarity. See Note:Grammar
Rule Definition for full details.
- Grammar: nofix bye exit
bye
calls the function `exit' with no arguments.
- Grammar: prefix - negate
- 42
Calls the function `negate' with the argument `42'.
- Grammar: infix - difference
x - y
Calls the function `difference' with arguments `x' and `y'.
- Grammar: nary + sum
x + y + z
Calls the function `sum' with arguments `x', `y', and `y'.
- Grammar: postfix ! factorial
5 !
Calls the function `factorial' with the argument `5'.
- Grammar: prestfix set set!
set foo bar
Calls the function `set!' with the arguments `foo' and `bar'.
- Grammar: commentfix /* */
/* almost any text here */
Ignores the comment delimited by `/*' and `*/'.
- Grammar: matchfix { list }
{0, 1, 2}
Calls the function `list' with the arguments `0', `1', and `2'.
- Grammar: inmatchfix ( funcall )
f(x, y)
Calls the function `funcall' with the arguments `f', `x', and `y'.
- Grammar: delim ;
set foo bar;
delimits the extent of the restfix operator `set'.
---------- Footnotes ----------
(1) How do I know this? I parsed 250kbyte of random input (an e-mail
file) with a non-trivial grammar utilizing all constructs.