A Child-Sibling Tree.
A tree with PLUS at the root and with two children 3 and 4 is
structured as:
PLUS
|
3 -- 4
and can be specified easily in LISP notation as
(PLUS 3 4)
where every '(' starts a new subtree.
These trees are particular useful for translators because of
the flexibility of the children lists.
A GrammarAnalyzer computes lookahead from Grammar (which contains
a grammar symbol table) and can then answer questions about the
grammar.
To access the RuleBlock for a rule name, the grammar symbol table
is consulted.
There should be no distinction between static & dynamic analysis.
In other words, some of the easy analysis can be done statically
and then the part that is hard statically can be deferred to
parse-time.
This token stream tracks the *entire* token stream coming from
a lexer, but does not pass on the whitespace (or whatever else
you want to discard) to the parser.
This class can then be asked for the ith token in the input stream.
Useful for dumping out the input stream exactly after doing some
augmentation or other manipulations.
A token stream MUX (multiplexor) knows about n token streams
and can multiplex them onto the same channel for use by token
stream consumer like a parser.