All Packages Class Hierarchy This Package Previous Next Index
Class javaParse.GrammarCalculator
java.lang.Object
|
+----javaParse.GrammarCalculator
- public class GrammarCalculator
- extends Object
This class is the powerhouse that does all the calculations.
Since each calculation is intimately related to others
they are all grouped together in this huge file but complex
file. I hope that you will find it well-commented and
easy to understand/modify.
-
LL1_MODE
-
-
LL2_MODE
-
-
LR1_MODE
-
-
GrammarCalculator(GrammarInfo, int)
- create a new GrammarCalculator
-
getDfaStates()
-
-
getFirsts()
-
-
getFirsts2()
-
-
getFollows()
-
-
getFollows2()
-
-
getParseTable()
-
-
getParseTableAsMatrix()
-
-
isValid()
-
-
setDfaStates(Vector)
-
LL1_MODE
public static final int LL1_MODE
LL2_MODE
public static final int LL2_MODE
LR1_MODE
public static final int LR1_MODE
GrammarCalculator
public GrammarCalculator(GrammarInfo g,
int mode)
- create a new GrammarCalculator
- Parameters:
- info - the GrammarInfo that this calculator will use
it must have at least one valid Production
- mode, - pick between GrammarCalculator.LL1_MODE,
GrammarCalculator.LL2_MODE,
GrammarCalculator.LR1_MODE,
or add your own modes and corresponding functions
isValid
public boolean isValid()
- Returns:
- true if no conflicts occur in the table
getFirsts
public String[] getFirsts()
- Returns:
- FIRST(variable)
String[] is in same order as the Variables Vector such that
the 0 element is FIRST(start symbol) ... nth is FIRST(nth alpha
betized variable). The n+1st entry is FIRST(1st Rhs) and continues
through the FIRST(last Rhs). The Grammar's Rhs is never modified
getFirsts2
public String[] getFirsts2()
- Returns:
- FIRST2(startsymbol) -> FIRST2(alphabetized variables)
getFollows
public String[] getFollows()
- Returns:
- FOLLOW(start symbol) -> FOLLOW(alphabetized variables)
getFollows2
public String[] getFollows2()
- Returns:
- FOLLOW2(start symbol) -> FOLLOW2(alphabetized variables)
String[]
getParseTableAsMatrix
public String[][] getParseTableAsMatrix()
- Returns:
- the entries in the ParseTable, without the ability to
see the row or col labels. entries can be accessed only
by [][] operations
getParseTable
public ParseTable getParseTable()
- Returns:
- a reference to the ParseTable for the GrammarInfo
that was given to GrammarCalculator's constructor
getDfaStates
public Vector getDfaStates()
- Returns:
- a vector of the states calculated in the Dfa
setDfaStates
public void setDfaStates(Vector v)
All Packages Class Hierarchy This Package Previous Next Index