|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.brics.grammar.Grammar
public class Grammar
Context-free grammar.
Constructor Summary | |
---|---|
Grammar(Grammar g)
Constructs a copy of the given grammar. |
|
Grammar(String start,
Collection<Production> productions)
Constructs a new grammar. |
Method Summary | |
---|---|
void |
addProductions(Collection<Production> newprods)
Adds new productions to this grammar. |
Collection<String> |
getNonterminals()
Returns the nonterminals that have productions. |
Production |
getProduction(ProductionID id)
Gets production with the given ID. |
Collection<Production> |
getProductions()
Returns the productions. |
Collection<Production> |
getProductions(String nonterminal)
Gets productions with the given left-hand-side nonterminal. |
String |
getStart()
Returns the start nonterminal. |
boolean |
isUnfolded()
Returns true if this grammar results from unfolding. |
void |
setStart(String start)
Sets the start nonterminal. |
void |
setUnfolded(boolean unfolded)
Sets the unfolded status of this grammar (default: false). |
String |
toString()
Returns string representation of the productions in this grammar. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Grammar(Grammar g)
public Grammar(String start, Collection<Production> productions)
start
- start nonterminalproductions
- collection of productionsMethod Detail |
---|
public void addProductions(Collection<Production> newprods)
newprods
- new productionspublic Collection<String> getNonterminals()
public Production getProduction(ProductionID id)
id
- production ID
public Collection<Production> getProductions()
public Collection<Production> getProductions(String nonterminal)
nonterminal
- nonterminal
public String getStart()
public boolean isUnfolded()
public void setStart(String start)
public void setUnfolded(boolean unfolded)
unfolded
- new unfolded statuspublic String toString()
toString
in class Object
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |