|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Lr1ParserTablesI
Generic LR(1) parser tables interface.
This interface is used to implement any kind of class containing state
transition tables for an LR(k) parser DFA. (Such a parsing machine should
implement the ParserI
interface.)
ParserI
,
Lr1ParserI
Field Summary | |
---|---|
static java.lang.String |
REV
Revision information. |
Method Summary | |
---|---|
int |
action(int state,
int laTok)
Retrieves the action to perform on a transition from a given state on a given terminal (lookahead) symbol. |
java.lang.String |
getNonterminalName(int n)
Retrieves the name of a nonterminal symbol (LHS) of the grammar. |
int |
getRhslength(int rule)
Retrieves the length of (i.e., the number of symbols in) the right-hand side (RHS) of a production rule of the grammar. |
java.lang.String |
getRuleText(int rule)
Retrieves the text of production rule of the grammar. |
java.lang.String |
getTerminalName(int n)
Retrieves the name of a terminal symbol (token) of the grammar. |
int |
goTo(int state,
int sym)
Retrieves the next state to transition to (i.e., the goto state) after a reduce action. |
java.lang.Object |
reduce(int rule,
java.lang.Object[] vStack,
int rhsIndex)
Execute an action code block associated with the reduction of a production rule of the grammar. |
Field Detail |
---|
static final java.lang.String REV
Method Detail |
---|
java.lang.String getTerminalName(int n)
n
- The serial number of the terminal symbol.
java.lang.String getNonterminalName(int n)
n
- The serial number of the nonterminal symbol.
java.lang.String getRuleText(int rule)
rule
- The rule number.
int getRhslength(int rule)
rule
- The rule number.
int action(int state, int laTok)
state
- The state number to transition from.laTok
- The token code of the lookahead terminal symbol to transition on.
int goTo(int state, int sym)
state
- The state number exposed on the top of the push-down DFA stack after the
reduce action has occurred.sym
- The nonterminal LHS symbol of the rule that was reduced.
java.lang.Object reduce(int rule, java.lang.Object[] vStack, int rhsIndex) throws java.lang.Exception
rule
- The rule number to reduce.vStack
- The parser's value stack.rhsIndex
- The index into the parser's value stack of the leftmost symbol of the RHS
of the rule to reduce by.
java.lang.Exception
- Thrown if a semantic error occurs and parsing should terminate
unsuccessfully.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |