|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgrammar.Grammar
grammar.cfg.MyGrammar
public class MyGrammar
Context-free grammars.
| Constructor Summary | |
|---|---|
MyGrammar()
Creates an instance of grammar. |
|
| Method Summary | |
|---|---|
void |
addProduction(Production production)
Adds a production to the set of productions in the grammar. |
void |
checkProduction(Production production)
Checks whether a production is invalid |
int |
getIndexOfStart()
Returns the index of start variable. |
int[][] |
getInfoOfPros()
Returns the information (indices and numbers) of sorted productions w.r.t. |
MyProduction[] |
getProductions()
Returns all productions in the grammar. |
java.lang.String[] |
getTerminals()
Returns all terminals in the grammar. |
java.lang.String[] |
getVariables()
Returns all variables in the grammar. |
boolean |
isSorted()
Returns whether the grammar is sorted or not. |
void |
setIndex()
Sets the indices of the tokens at the productions. |
void |
setIndexOfStart(int indexOfStart)
Sets the index of start variable and changes the start variable simultaneity. |
void |
setStartVariable(java.lang.String variable)
Sets the start variable and changes the index of start variable simultaneity. |
void |
sortAndIndex()
Sorts the variables, terminals, and productions of the grammar, and sets the indices of the tokens at the productions. |
| Methods inherited from class grammar.Grammar |
|---|
addProductions, equals, getProductionsNumber, getStartVariable, getTerminalsNumber, getVariablesNumber, hashCode, isEmpty, reachability, toString, usefulness |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MyGrammar()
| Method Detail |
|---|
public void checkProduction(Production production)
Grammar
checkProduction in class Grammarproduction - the production to checkpublic MyProduction[] getProductions()
Grammar
getProductions in class Grammarpublic boolean isSorted()
public int getIndexOfStart()
public void setIndexOfStart(int indexOfStart)
indexOfStart - the start variable index to set
java.lang.IllegalArgumentException - if the indexOfStart is illegal.public void setStartVariable(java.lang.String variable)
setStartVariable in class Grammarvariable - the start variable to set
java.lang.IllegalArgumentException - if the variable is not in the variablespublic java.lang.String[] getVariables()
Grammar
getVariables in class Grammarpublic java.lang.String[] getTerminals()
Grammar
getTerminals in class Grammarpublic void addProduction(Production production)
Grammar
addProduction in class Grammarproduction - the production to be added.public int[][] getInfoOfPros()
public void sortAndIndex()
public void setIndex()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||