|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.common.spec.grammar.CommonGrammar
public class CommonGrammar
From Project: Caymman(DSC/UFCG) Description: This class represents a LL(1) grammar.
Constructor Summary | |
---|---|
CommonGrammar()
|
Method Summary | |
---|---|
void |
addRule(Rule rule)
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 id)
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. |
java.util.Iterator<Rule> |
getRules()
Gets all the rules of the grammar. |
Symbol |
getSymbol(java.lang.String symbolName)
Gets the symbol represented by the symbolName |
int |
lastNonTerminal()
The code of the last non terminal symbol in the grammar. |
int |
lastTerminal()
The code of the last terminal symbol in the grammar. |
void |
loadSyntacticTable()
Loads the internal syntactical table using the rules and symbols inserted. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommonGrammar()
Grammar
Method Detail |
---|
public void addSymbol(Symbol symbol)
Grammar
addSymbol
in interface Grammar
symbol
- The symbol to be added.Grammar.addSymbol(Symbol)
public void addRule(Rule rule)
Grammar
addRule
in interface Grammar
rule
- The Rule to be inserted at the grammar.Grammar.addRule(Rule)
public Symbol getSymbol(java.lang.String symbolName)
Grammar
getSymbol
in interface Grammar
symbolName
- The symbolName in the grammar that represents the
required symbol.
Grammar.getSymbol(java.lang.String)
public Rule getRule(int id)
Grammar
getRule
in interface Grammar
id
- The rule number.
Grammar.getRule(int)
public Rule getRule(Symbol stackTop, Symbol nextSymbol)
Grammar
getRule
in interface Grammar
stackTop
- The symbol at the stack top.nextSymbol
- The symbol just read from source.
Grammar.getRule(Symbol,Symbol)
public Symbol getInitialSymbol()
Grammar
getInitialSymbol
in interface Grammar
Grammar.getInitialSymbol()
public Symbol getEndOfSourceSymbol()
Grammar
getEndOfSourceSymbol
in interface Grammar
Grammar.getEndOfSourceSymbol()
public int lastTerminal()
public int lastNonTerminal()
public java.util.Iterator<Rule> getRules()
public void loadSyntacticTable()
GrammarReader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |