|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Grammar
This interface is one of the principal parts of the syntactical module of a compiler. It handles every operation about the language and its formation rules.
Method Summary | |
---|---|
void |
addRule(Rule newRule)
Adds a new rule to the grammar. |
void |
addSymbol(Symbol symbol)
Adds a symbol in the grammar. |
Symbol |
getEndOfSourceSymbol()
Defines the last symbol from source. |
Symbol |
getInitialSymbol()
Returns the initial symbol of the grammar. |
Rule |
getRule(int ruleNumber)
Returns the rule defined by a given number. |
Rule |
getRule(Symbol stackTop,
Symbol nextSymbol)
At a syntactical compilation ( considering a predictor LL(n) grammar) this is one of the principal operations, that is: at one certain moment, where the next symbol from source and the stack top are non-terminals, it is necessary to know what rule from grammar has to be used to continue with the process. |
Symbol |
getSymbol(java.lang.String symbolName)
Gets the symbol represented by the symbolName |
Method Detail |
---|
Rule getRule(Symbol stackTop, Symbol nextSymbol)
stackTop
- The symbol at the stack top.nextSymbol
- The symbol just read from source.
Rule getRule(int ruleNumber)
ruleNumber
- The rule number.
void addRule(Rule newRule)
newRule
- The Rule to be inserted at the grammar.void addSymbol(Symbol symbol)
symbol
- The symbol to be added.Symbol getSymbol(java.lang.String symbolName)
symbolName
- The symbolName in the grammar that represents the
required symbol.
Symbol getInitialSymbol()
Symbol getEndOfSourceSymbol()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |