|
Generic Interpreter 1.3 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.LR0_Grammar
gi.SLR1_Grammar
public class SLR1_Grammar
This class implements an SLR(1) parser around a Grammar. The parser adapts to changes in the underlying Grammar. Semantics in a phrase are evaluated during a bottom-up parse, from left to right after all subtrees rooted in the phrase have been constructed. Attributes throughout the phrase are available during evaluation. SLR(1) parsing is more space- and time-efficient than LR(1) parsing; however, SLR(1) parsing is more easily confused than LR(1) parsing, since it considers lookahead terminals generally following a nonterminal (rather than specifically following it in a context) to choose between applicable phrases.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class gi.LR0_Grammar |
|---|
LR0_Grammar.Context, LR0_Grammar.Set<E extends LR0_Grammar.Context> |
| Nested classes/interfaces inherited from class gi.Grammar |
|---|
Grammar.ParseTree, Grammar.Production, Grammar.Semantics |
| Nested classes/interfaces inherited from class gi.Lexicon |
|---|
Lexicon.Alphabet, Lexicon.Concatenation, Lexicon.Exception, Lexicon.Expression, Lexicon.Match, Lexicon.NonMatch, Lexicon.PosixClass, Lexicon.Range, Lexicon.Repetition, Lexicon.Singleton, Lexicon.UnicodeCategory, Lexicon.Union |
| Field Summary |
|---|
| Fields inherited from class gi.LR0_Grammar |
|---|
S$ |
| 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 |
SLR1_Grammar()
Constructs an SLR(1) parser around a new empty Grammar. |
protected |
SLR1_Grammar(Grammar G)
Constructs an SLR(1) parser around an existing Grammar. |
| Method Summary | |
|---|---|
(package private) Lexicon.Set<Object> |
expected(LR0_Grammar.Set<LR0_Grammar.Context> C)
Computes the terminals expected in a Set of LR(0) Contexts. |
(package private) Grammar.Production |
parse(LR0_Grammar.Set<LR0_Grammar.Context> C,
Object a)
Computes the Production to use in a reverse rightmost derivation. |
String |
toString()
Returns the string representation of this parser, specifically "SLR(1)". |
| Methods inherited from class gi.LR0_Grammar |
|---|
closure, initial, interpret, transition |
| 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, wait, wait, wait |
| Constructor Detail |
|---|
protected SLR1_Grammar()
Constructs an SLR(1) parser around a new empty Grammar.
protected SLR1_Grammar(Grammar G)
Constructs an SLR(1) parser around an existing Grammar.
G - the Grammar around which the parser is constructed.| Method Detail |
|---|
Grammar.Production parse(LR0_Grammar.Set<LR0_Grammar.Context> C,
Object a)
Computes the Production to use in a reverse rightmost derivation.
parse in class LR0_GrammarC - the Set of LR(0) Contexts.a - the lookahead terminal.
Production underlying an applicable reduce Context in C; returns null if none.Lexicon.Set<Object> expected(LR0_Grammar.Set<LR0_Grammar.Context> C)
Computes the terminals expected in a Set of LR(0) Contexts.
expected in class LR0_GrammarC - the Set of LR(0) Contexts.
Context in C.public String toString()
Returns the string representation of this parser, specifically "SLR(1)".
toString in class LR0_Grammar
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||