|
Generic Interpreter 1.2 Private API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgi.Lexicon
gi.Grammar
gi.LL1_Grammar
This class implements an LL(1) parser around a Grammar. The parser adapts to changes in the underlying Grammar. Semantics in a phrase are evaluated during a top-down left-to-right recursive descent parse, when they are first visited. Attributes above or to the left of the Semantics are available during evaluation. A Grammar with left-recursive productions can cause infinite recursion, unless productions that terminate recursion have priority over productions that recurse.
| Nested Class Summary |
| Nested classes inherited from class gi.Grammar |
Grammar.ParseTree, Grammar.Production, Grammar.Semantics |
| Nested classes inherited from class gi.Lexicon |
Lexicon.Alphabet, Lexicon.Concatenation, Lexicon.Exception, Lexicon.Expression, Lexicon.Match, Lexicon.NonMatch, Lexicon.PosixClass, Lexicon.Range, Lexicon.Repetition, Lexicon.Set, Lexicon.Singleton, Lexicon.Stack, Lexicon.UnicodeCategory, Lexicon.Union |
| Field Summary | |
private Object |
a
The lookahead terminal. |
| Fields inherited from class gi.Grammar |
CONFLICT, FIRST_FOLLOW, P, PARSE_TREE, S, SYNTAX |
| Fields inherited from class gi.Lexicon |
$, debug, LEXICAL, TERMINALS, VERBOSE |
| Constructor Summary | |
protected |
LL1_Grammar()
Constructs an LL(1) parser around a new empty Grammar. |
protected |
LL1_Grammar(Grammar G)
Constructs an LL(1) parser around an existing Grammar. |
| Method Summary | |
private void |
descend(LineNumberReader source,
Grammar.ParseTree t)
Completes a seed ParseTree by LL(1) recursive descent. |
private Lexicon.Set |
expected(Object A)
Computes the terminals matching a nonterminal. |
(package private) Object |
interpret(LineNumberReader source)
Interprets a source character stream by LL(1) recursive descent. |
private Grammar.Production |
parse(Object A,
Object a)
Computes a Production to use in a leftmost derivation. |
| Methods inherited from class gi.Grammar |
first, first, first, follow, grab, interpret, nonterminal, put, put, terminal |
| Methods inherited from class gi.Lexicon |
expression, interpret, interpret, interpret, interpret, interpret, interpret, put, word |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Object a
The lookahead terminal.
| Constructor Detail |
protected LL1_Grammar()
Constructs an LL(1) parser around a new empty Grammar.
protected LL1_Grammar(Grammar G)
Constructs an LL(1) parser around an existing Grammar.
G - the Grammar around which the parser is constructed.| Method Detail |
private void descend(LineNumberReader source,
Grammar.ParseTree t)
throws Lexicon.Exception
Completes a seed ParseTree by LL(1) recursive descent.
source - the source character stream.t - a seed ParseTree to be completed by interpreting source.
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.private Lexicon.Set expected(Object A)
Computes the terminals matching a nonterminal.
A - the expected nonterminal.
Object interpret(LineNumberReader source)
throws Lexicon.Exception
Interprets a source character stream by LL(1) recursive descent.
interpret in class Grammarsource - the source character stream.
ParseTree constructed by interpreting source.
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.
private Grammar.Production parse(Object A,
Object a)
Computes a Production to use in a leftmost derivation.
A - the expected nonterminal.a - the lookahead terminal.
Production with which to replace the expected nonterminal and eventually match the lookahead terminal; returns null if none.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||