fixed 四元式
This commit is contained in:
1 parent
3d84845be3
commit
8cc5403f34
4 files changed
+5
-53
No files matched your search
Whitespace-only changes.
@@ -1,52 +0,0 @@
|
||||
package com.compiler.lexer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ConstantChecker extends Automaton {
|
||||
|
||||
ConstantChecker() {
|
||||
transitionForm.put(new StatePair(STATE0, decHeader), STATE1);
|
||||
transitionForm.put(new StatePair(STATE1, decNumber), STATE1);
|
||||
transitionForm.put(new StatePair(STATE1, euler), STATE3);
|
||||
transitionForm.put(new StatePair(STATE1, empty), INTEGER);
|
||||
}
|
||||
|
||||
private final int STATE0 = 0;
|
||||
private final int STATE1 = 1;
|
||||
private final int STATE2 = 2;
|
||||
private final int STATE3 = 3;
|
||||
private final int STATE4 = 4;
|
||||
private final int STATE5 = 5;
|
||||
private final int STATE6 = 6;
|
||||
private final int STATE7 = 7;
|
||||
private final int INTEGER = 8;
|
||||
|
||||
HashSet<Character> zero;
|
||||
HashSet<Character> hexX;
|
||||
HashSet<Character> decHeader;
|
||||
HashSet<Character> decNumber;
|
||||
HashSet<Character> octNumber;
|
||||
HashSet<Character> hexNumber;
|
||||
HashSet<Character> dot;
|
||||
HashSet<Character> euler;
|
||||
|
||||
|
||||
private HashMap<StatePair, Integer> transitionForm = new HashMap<>();
|
||||
private HashSet<Integer> acceptStates = new HashSet<>();
|
||||
|
||||
@Override
|
||||
int getStartState() {
|
||||
return STATE0;
|
||||
}
|
||||
|
||||
@Override
|
||||
HashSet<Integer> getAcceptStates() {
|
||||
return acceptStates;
|
||||
}
|
||||
|
||||
@Override
|
||||
HashMap<StatePair, Integer> getTransitionForm() {
|
||||
return transitionForm;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.compiler.lexer;
|
||||
|
||||
public class LexerTester {
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public class Quaternary {
|
||||
|
||||
}
|
||||
|
||||
enum operation {ADD, SUB, MUL, DIV, EQUAL}
|
||||
public enum operation {ADD, SUB, MUL, DIV, EQUAL}
|
||||
|
||||
operation opt;
|
||||
String opd1, opd2, opd3;
|
||||
|
||||
Reference in new issue
Block a user