public final class DFA
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) Action[] |
action
action[state] is the action that is to be carried out in
state state , null if there is no action. |
(package private) int[] |
entryState
entryState[i] is the start-state of lexical state i or
lookahead DFA i
|
(package private) boolean[] |
isFinal
isFinal[state] == true <=> the state state is
a final state. |
(package private) boolean |
lookaheadUsed
True iff this DFA contains general lookahead
|
static int |
NO_TARGET
The code for "no target state" in the transition table.
|
(package private) int |
numInput
The current maximum number of input characters
|
(package private) int |
numLexStates
The number of lexical states (2*numLexStates <= entryState.length)
|
(package private) int |
numStates
The number of states in this DFA
|
private static int |
STATES
The initial number of states
|
(package private) int[][] |
table
table[current_state][character] is the next state for
current_state
with input character , NO_TARGET if there is no transition for
this input in current_state |
(package private) java.util.Map<Action,Action> |
usedActions
all actions that are used in this DFA
|
Constructor and Description |
---|
DFA(int numEntryStates,
int numInp,
int numLexStates) |
Modifier and Type | Method and Description |
---|---|
void |
addTransition(int start,
int input,
int dest) |
void |
checkActions(LexScan scanner,
LexParse parser)
Check that all actions can actually be matched in this DFA.
|
java.lang.String |
dotFormat() |
private void |
ensureStateCapacity(int newNumStates) |
void |
minimize()
Implementation of Hopcroft's O(n log n) minimization algorithm, follows
description by D.
|
boolean[][] |
old_minimize()
Much simpler, but slower and less memory efficient minimization algorithm.
|
void |
printBlocks(int[] b,
int[] b_f,
int[] b_b,
int last) |
void |
printInvDelta(int[][] inv_delta,
int[] inv_delta_set) |
void |
printL(int[] l_f,
int[] l_b,
int anchor) |
void |
printTable(boolean[][] equiv) |
void |
setAction(int state,
Action stateAction) |
void |
setEntryState(int eState,
int trueState) |
void |
setFinal(int state,
boolean isFinalState) |
java.lang.String |
toString() |
java.lang.String |
toString(int[] a) |
void |
writeDot(java.io.File file) |
private static final int STATES
public static final int NO_TARGET
int[][] table
current_state
with input character
, NO_TARGET
if there is no transition for
this input in current_state
boolean[] isFinal
isFinal[state] == true
<=> the state state
is
a final state.Action[] action
action[state]
is the action that is to be carried out in
state state
, null
if there is no action.int[] entryState
int numStates
int numInput
int numLexStates
boolean lookaheadUsed
public void setEntryState(int eState, int trueState)
private void ensureStateCapacity(int newNumStates)
public void setAction(int state, Action stateAction)
public void setFinal(int state, boolean isFinalState)
public void addTransition(int start, int input, int dest)
public java.lang.String toString()
toString
in class java.lang.Object
public void writeDot(java.io.File file)
public java.lang.String dotFormat()
public void checkActions(LexScan scanner, LexParse parser)
public void minimize()
public java.lang.String toString(int[] a)
public void printBlocks(int[] b, int[] b_f, int[] b_b, int last)
public void printL(int[] l_f, int[] l_b, int anchor)
public boolean[][] old_minimize()
public void printInvDelta(int[][] inv_delta, int[] inv_delta_set)
public void printTable(boolean[][] equiv)