diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
| commit | 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch) | |
| tree | ed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5300/project-three/lexer | |
| download | misc-undergrad-main.tar.gz misc-undergrad-main.zip | |
Diffstat (limited to 'Homework/cs5300/project-three/lexer')
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ExprLexer.interp | 52 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ExprLexer.java | 145 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ExprLexer.tokens | 17 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ParenLexer.interp | 26 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ParenLexer.java | 121 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/ParenLexer.tokens | 5 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/SimpleLexer.interp | 23 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/SimpleLexer.java | 120 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/SimpleLexer.tokens | 3 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/TinyLexer.interp | 79 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/TinyLexer.java | 164 | ||||
| -rw-r--r-- | Homework/cs5300/project-three/lexer/TinyLexer.tokens | 36 |
12 files changed, 791 insertions, 0 deletions
diff --git a/Homework/cs5300/project-three/lexer/ExprLexer.interp b/Homework/cs5300/project-three/lexer/ExprLexer.interp new file mode 100644 index 0000000..c9ec8c0 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ExprLexer.interp @@ -0,0 +1,52 @@ +token literal names: +null +'+' +'-' +'*' +'/' +'(' +')' +null +null +null +null +null + +token symbolic names: +null +PLUS +MINUS +MULTIPLY +DIVIDE +OPAREN +CPAREN +FLOAT +INT +IDENTIFIER +COMMENT +WS + +rule names: +PLUS +MINUS +MULTIPLY +DIVIDE +OPAREN +CPAREN +FLOAT +INT +IDENTIFIER +COMMENT +WS +LETTER +DIGIT + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 13, 104, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 6, 8, 43, 10, 8, 13, 8, 14, 8, 44, 3, 8, 3, 8, 6, 8, 49, 10, 8, 13, 8, 14, 8, 50, 3, 9, 6, 9, 54, 10, 9, 13, 9, 14, 9, 55, 3, 10, 3, 10, 3, 10, 7, 10, 61, 10, 10, 12, 10, 14, 10, 64, 11, 10, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 70, 10, 11, 12, 11, 14, 11, 73, 11, 11, 3, 11, 5, 11, 76, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 83, 10, 11, 12, 11, 14, 11, 86, 11, 11, 3, 11, 3, 11, 5, 11, 90, 10, 11, 3, 11, 3, 11, 3, 12, 6, 12, 95, 10, 12, 13, 12, 14, 12, 96, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 84, 2, 15, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 2, 27, 2, 3, 2, 5, 4, 2, 12, 12, 15, 15, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 67, 92, 99, 124, 2, 111, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 3, 29, 3, 2, 2, 2, 5, 31, 3, 2, 2, 2, 7, 33, 3, 2, 2, 2, 9, 35, 3, 2, 2, 2, 11, 37, 3, 2, 2, 2, 13, 39, 3, 2, 2, 2, 15, 42, 3, 2, 2, 2, 17, 53, 3, 2, 2, 2, 19, 57, 3, 2, 2, 2, 21, 89, 3, 2, 2, 2, 23, 94, 3, 2, 2, 2, 25, 100, 3, 2, 2, 2, 27, 102, 3, 2, 2, 2, 29, 30, 7, 45, 2, 2, 30, 4, 3, 2, 2, 2, 31, 32, 7, 47, 2, 2, 32, 6, 3, 2, 2, 2, 33, 34, 7, 44, 2, 2, 34, 8, 3, 2, 2, 2, 35, 36, 7, 49, 2, 2, 36, 10, 3, 2, 2, 2, 37, 38, 7, 42, 2, 2, 38, 12, 3, 2, 2, 2, 39, 40, 7, 43, 2, 2, 40, 14, 3, 2, 2, 2, 41, 43, 5, 27, 14, 2, 42, 41, 3, 2, 2, 2, 43, 44, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 46, 3, 2, 2, 2, 46, 48, 7, 48, 2, 2, 47, 49, 5, 27, 14, 2, 48, 47, 3, 2, 2, 2, 49, 50, 3, 2, 2, 2, 50, 48, 3, 2, 2, 2, 50, 51, 3, 2, 2, 2, 51, 16, 3, 2, 2, 2, 52, 54, 5, 27, 14, 2, 53, 52, 3, 2, 2, 2, 54, 55, 3, 2, 2, 2, 55, 53, 3, 2, 2, 2, 55, 56, 3, 2, 2, 2, 56, 18, 3, 2, 2, 2, 57, 62, 5, 25, 13, 2, 58, 61, 5, 25, 13, 2, 59, 61, 5, 27, 14, 2, 60, 58, 3, 2, 2, 2, 60, 59, 3, 2, 2, 2, 61, 64, 3, 2, 2, 2, 62, 60, 3, 2, 2, 2, 62, 63, 3, 2, 2, 2, 63, 20, 3, 2, 2, 2, 64, 62, 3, 2, 2, 2, 65, 66, 7, 49, 2, 2, 66, 67, 7, 49, 2, 2, 67, 71, 3, 2, 2, 2, 68, 70, 10, 2, 2, 2, 69, 68, 3, 2, 2, 2, 70, 73, 3, 2, 2, 2, 71, 69, 3, 2, 2, 2, 71, 72, 3, 2, 2, 2, 72, 75, 3, 2, 2, 2, 73, 71, 3, 2, 2, 2, 74, 76, 7, 15, 2, 2, 75, 74, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 90, 7, 12, 2, 2, 78, 79, 7, 49, 2, 2, 79, 80, 7, 44, 2, 2, 80, 84, 3, 2, 2, 2, 81, 83, 11, 2, 2, 2, 82, 81, 3, 2, 2, 2, 83, 86, 3, 2, 2, 2, 84, 85, 3, 2, 2, 2, 84, 82, 3, 2, 2, 2, 85, 87, 3, 2, 2, 2, 86, 84, 3, 2, 2, 2, 87, 88, 7, 44, 2, 2, 88, 90, 7, 49, 2, 2, 89, 65, 3, 2, 2, 2, 89, 78, 3, 2, 2, 2, 90, 91, 3, 2, 2, 2, 91, 92, 8, 11, 2, 2, 92, 22, 3, 2, 2, 2, 93, 95, 9, 3, 2, 2, 94, 93, 3, 2, 2, 2, 95, 96, 3, 2, 2, 2, 96, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 98, 3, 2, 2, 2, 98, 99, 8, 12, 2, 2, 99, 24, 3, 2, 2, 2, 100, 101, 9, 4, 2, 2, 101, 26, 3, 2, 2, 2, 102, 103, 4, 50, 59, 2, 103, 28, 3, 2, 2, 2, 13, 2, 44, 50, 55, 60, 62, 71, 75, 84, 89, 96, 3, 8, 2, 2]
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/ExprLexer.java b/Homework/cs5300/project-three/lexer/ExprLexer.java new file mode 100644 index 0000000..b9d760b --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ExprLexer.java @@ -0,0 +1,145 @@ +// Generated from ExprLexer.tokens by ANTLR 4.9.1 +package lexer; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class ExprLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + PLUS=1, MINUS=2, MULTIPLY=3, DIVIDE=4, OPAREN=5, CPAREN=6, FLOAT=7, INT=8, + IDENTIFIER=9, COMMENT=10, WS=11; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "OPAREN", "CPAREN", "FLOAT", "INT", + "IDENTIFIER", "COMMENT", "WS", "LETTER", "DIGIT" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'+'", "'-'", "'*'", "'/'", "'('", "')'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "OPAREN", "CPAREN", "FLOAT", + "INT", "IDENTIFIER", "COMMENT", "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = "<INVALID>"; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public ExprLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "ExprLexer.tokens"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\rh\b\1\4\2\t\2\4"+ + "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ + "\13\4\f\t\f\4\r\t\r\4\16\t\16\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6"+ + "\3\7\3\7\3\b\6\b+\n\b\r\b\16\b,\3\b\3\b\6\b\61\n\b\r\b\16\b\62\3\t\6\t"+ + "\66\n\t\r\t\16\t\67\3\n\3\n\3\n\7\n=\n\n\f\n\16\n@\13\n\3\13\3\13\3\13"+ + "\3\13\7\13F\n\13\f\13\16\13I\13\13\3\13\5\13L\n\13\3\13\3\13\3\13\3\13"+ + "\3\13\7\13S\n\13\f\13\16\13V\13\13\3\13\3\13\5\13Z\n\13\3\13\3\13\3\f"+ + "\6\f_\n\f\r\f\16\f`\3\f\3\f\3\r\3\r\3\16\3\16\3T\2\17\3\3\5\4\7\5\t\6"+ + "\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\2\33\2\3\2\5\4\2\f\f\17\17\5\2"+ + "\13\f\16\17\"\"\4\2C\\c|\2o\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3"+ + "\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2"+ + "\2\25\3\2\2\2\2\27\3\2\2\2\3\35\3\2\2\2\5\37\3\2\2\2\7!\3\2\2\2\t#\3\2"+ + "\2\2\13%\3\2\2\2\r\'\3\2\2\2\17*\3\2\2\2\21\65\3\2\2\2\239\3\2\2\2\25"+ + "Y\3\2\2\2\27^\3\2\2\2\31d\3\2\2\2\33f\3\2\2\2\35\36\7-\2\2\36\4\3\2\2"+ + "\2\37 \7/\2\2 \6\3\2\2\2!\"\7,\2\2\"\b\3\2\2\2#$\7\61\2\2$\n\3\2\2\2%"+ + "&\7*\2\2&\f\3\2\2\2\'(\7+\2\2(\16\3\2\2\2)+\5\33\16\2*)\3\2\2\2+,\3\2"+ + "\2\2,*\3\2\2\2,-\3\2\2\2-.\3\2\2\2.\60\7\60\2\2/\61\5\33\16\2\60/\3\2"+ + "\2\2\61\62\3\2\2\2\62\60\3\2\2\2\62\63\3\2\2\2\63\20\3\2\2\2\64\66\5\33"+ + "\16\2\65\64\3\2\2\2\66\67\3\2\2\2\67\65\3\2\2\2\678\3\2\2\28\22\3\2\2"+ + "\29>\5\31\r\2:=\5\31\r\2;=\5\33\16\2<:\3\2\2\2<;\3\2\2\2=@\3\2\2\2><\3"+ + "\2\2\2>?\3\2\2\2?\24\3\2\2\2@>\3\2\2\2AB\7\61\2\2BC\7\61\2\2CG\3\2\2\2"+ + "DF\n\2\2\2ED\3\2\2\2FI\3\2\2\2GE\3\2\2\2GH\3\2\2\2HK\3\2\2\2IG\3\2\2\2"+ + "JL\7\17\2\2KJ\3\2\2\2KL\3\2\2\2LM\3\2\2\2MZ\7\f\2\2NO\7\61\2\2OP\7,\2"+ + "\2PT\3\2\2\2QS\13\2\2\2RQ\3\2\2\2SV\3\2\2\2TU\3\2\2\2TR\3\2\2\2UW\3\2"+ + "\2\2VT\3\2\2\2WX\7,\2\2XZ\7\61\2\2YA\3\2\2\2YN\3\2\2\2Z[\3\2\2\2[\\\b"+ + "\13\2\2\\\26\3\2\2\2]_\t\3\2\2^]\3\2\2\2_`\3\2\2\2`^\3\2\2\2`a\3\2\2\2"+ + "ab\3\2\2\2bc\b\f\2\2c\30\3\2\2\2de\t\4\2\2e\32\3\2\2\2fg\4\62;\2g\34\3"+ + "\2\2\2\r\2,\62\67<>GKTY`\3\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +}
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/ExprLexer.tokens b/Homework/cs5300/project-three/lexer/ExprLexer.tokens new file mode 100644 index 0000000..295e180 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ExprLexer.tokens @@ -0,0 +1,17 @@ +PLUS=1 +MINUS=2 +MULTIPLY=3 +DIVIDE=4 +OPAREN=5 +CPAREN=6 +FLOAT=7 +INT=8 +IDENTIFIER=9 +COMMENT=10 +WS=11 +'+'=1 +'-'=2 +'*'=3 +'/'=4 +'('=5 +')'=6 diff --git a/Homework/cs5300/project-three/lexer/ParenLexer.interp b/Homework/cs5300/project-three/lexer/ParenLexer.interp new file mode 100644 index 0000000..d973cba --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ParenLexer.interp @@ -0,0 +1,26 @@ +token literal names: +null +'(' +')' +null + +token symbolic names: +null +OPAREN +CPAREN +WS + +rule names: +OPAREN +CPAREN +WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 5, 20, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 6, 4, 15, 10, 4, 13, 4, 14, 4, 16, 3, 4, 3, 4, 2, 2, 5, 3, 3, 5, 4, 7, 5, 3, 2, 3, 5, 2, 11, 12, 14, 15, 34, 34, 2, 20, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 3, 9, 3, 2, 2, 2, 5, 11, 3, 2, 2, 2, 7, 14, 3, 2, 2, 2, 9, 10, 7, 42, 2, 2, 10, 4, 3, 2, 2, 2, 11, 12, 7, 43, 2, 2, 12, 6, 3, 2, 2, 2, 13, 15, 9, 2, 2, 2, 14, 13, 3, 2, 2, 2, 15, 16, 3, 2, 2, 2, 16, 14, 3, 2, 2, 2, 16, 17, 3, 2, 2, 2, 17, 18, 3, 2, 2, 2, 18, 19, 8, 4, 2, 2, 19, 8, 3, 2, 2, 2, 4, 2, 16, 3, 8, 2, 2]
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/ParenLexer.java b/Homework/cs5300/project-three/lexer/ParenLexer.java new file mode 100644 index 0000000..3ac9511 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ParenLexer.java @@ -0,0 +1,121 @@ +// Generated from ParenLexer.tokens by ANTLR 4.9.1 +package lexer; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class ParenLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + OPAREN=1, CPAREN=2, WS=3; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "OPAREN", "CPAREN", "WS" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'('", "')'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "OPAREN", "CPAREN", "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = "<INVALID>"; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public ParenLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "ParenLexer.tokens"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\5\24\b\1\4\2\t\2"+ + "\4\3\t\3\4\4\t\4\3\2\3\2\3\3\3\3\3\4\6\4\17\n\4\r\4\16\4\20\3\4\3\4\2"+ + "\2\5\3\3\5\4\7\5\3\2\3\5\2\13\f\16\17\"\"\2\24\2\3\3\2\2\2\2\5\3\2\2\2"+ + "\2\7\3\2\2\2\3\t\3\2\2\2\5\13\3\2\2\2\7\16\3\2\2\2\t\n\7*\2\2\n\4\3\2"+ + "\2\2\13\f\7+\2\2\f\6\3\2\2\2\r\17\t\2\2\2\16\r\3\2\2\2\17\20\3\2\2\2\20"+ + "\16\3\2\2\2\20\21\3\2\2\2\21\22\3\2\2\2\22\23\b\4\2\2\23\b\3\2\2\2\4\2"+ + "\20\3\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +}
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/ParenLexer.tokens b/Homework/cs5300/project-three/lexer/ParenLexer.tokens new file mode 100644 index 0000000..a29ddff --- /dev/null +++ b/Homework/cs5300/project-three/lexer/ParenLexer.tokens @@ -0,0 +1,5 @@ +OPAREN=1 +CPAREN=2 +WS=3 +'('=1 +')'=2 diff --git a/Homework/cs5300/project-three/lexer/SimpleLexer.interp b/Homework/cs5300/project-three/lexer/SimpleLexer.interp new file mode 100644 index 0000000..8d4c41c --- /dev/null +++ b/Homework/cs5300/project-three/lexer/SimpleLexer.interp @@ -0,0 +1,23 @@ +token literal names: +null +'x' +null + +token symbolic names: +null +X +WS + +rule names: +X +WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 4, 16, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 3, 2, 3, 2, 3, 3, 6, 3, 11, 10, 3, 13, 3, 14, 3, 12, 3, 3, 3, 3, 2, 2, 4, 3, 3, 5, 4, 3, 2, 3, 5, 2, 11, 12, 14, 15, 34, 34, 2, 16, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 3, 7, 3, 2, 2, 2, 5, 10, 3, 2, 2, 2, 7, 8, 7, 122, 2, 2, 8, 4, 3, 2, 2, 2, 9, 11, 9, 2, 2, 2, 10, 9, 3, 2, 2, 2, 11, 12, 3, 2, 2, 2, 12, 10, 3, 2, 2, 2, 12, 13, 3, 2, 2, 2, 13, 14, 3, 2, 2, 2, 14, 15, 8, 3, 2, 2, 15, 6, 3, 2, 2, 2, 4, 2, 12, 3, 8, 2, 2]
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/SimpleLexer.java b/Homework/cs5300/project-three/lexer/SimpleLexer.java new file mode 100644 index 0000000..f6ce847 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/SimpleLexer.java @@ -0,0 +1,120 @@ +// Generated from SimpleLexer.tokens by ANTLR 4.9.1 +package lexer; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class SimpleLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + X=1, WS=2; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "X", "WS" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'x'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "X", "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = "<INVALID>"; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public SimpleLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "SimpleLexer.tokens"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\4\20\b\1\4\2\t\2"+ + "\4\3\t\3\3\2\3\2\3\3\6\3\13\n\3\r\3\16\3\f\3\3\3\3\2\2\4\3\3\5\4\3\2\3"+ + "\5\2\13\f\16\17\"\"\2\20\2\3\3\2\2\2\2\5\3\2\2\2\3\7\3\2\2\2\5\n\3\2\2"+ + "\2\7\b\7z\2\2\b\4\3\2\2\2\t\13\t\2\2\2\n\t\3\2\2\2\13\f\3\2\2\2\f\n\3"+ + "\2\2\2\f\r\3\2\2\2\r\16\3\2\2\2\16\17\b\3\2\2\17\6\3\2\2\2\4\2\f\3\b\2"+ + "\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +}
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/SimpleLexer.tokens b/Homework/cs5300/project-three/lexer/SimpleLexer.tokens new file mode 100644 index 0000000..dc07319 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/SimpleLexer.tokens @@ -0,0 +1,3 @@ +X=1 +WS=2 +'x'=1 diff --git a/Homework/cs5300/project-three/lexer/TinyLexer.interp b/Homework/cs5300/project-three/lexer/TinyLexer.interp new file mode 100644 index 0000000..a2db21e --- /dev/null +++ b/Homework/cs5300/project-three/lexer/TinyLexer.interp @@ -0,0 +1,79 @@ +token literal names: +null +'if' +'then' +'else' +'end' +'repeat' +'until' +'read' +'write' +'(' +')' +'+' +'-' +'*' +'/' +'<' +'=' +null +null +null +null + +token symbolic names: +null +IF +THEN +ELSE +END +REPEAT +UNTIL +READ +WRITE +OPAREN +CPAREN +PLUS +MINUS +MULTIPLY +DIVIDE +LT +EQUAL +NUM +ID +COMMENT +WS + +rule names: +IF +THEN +ELSE +END +REPEAT +UNTIL +READ +WRITE +OPAREN +CPAREN +PLUS +MINUS +MULTIPLY +DIVIDE +LT +EQUAL +NUM +ID +COMMENT +WS +LETTER +DIGIT + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 22, 153, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 6, 18, 106, 10, 18, 13, 18, 14, 18, 107, 3, 19, 6, 19, 111, 10, 19, 13, 19, 14, 19, 112, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 119, 10, 20, 12, 20, 14, 20, 122, 11, 20, 3, 20, 5, 20, 125, 10, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 132, 10, 20, 12, 20, 14, 20, 135, 11, 20, 3, 20, 3, 20, 5, 20, 139, 10, 20, 3, 20, 3, 20, 3, 21, 6, 21, 144, 10, 21, 13, 21, 14, 21, 145, 3, 21, 3, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 133, 2, 24, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 2, 45, 2, 3, 2, 5, 4, 2, 12, 12, 15, 15, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 67, 92, 99, 124, 2, 157, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 3, 47, 3, 2, 2, 2, 5, 50, 3, 2, 2, 2, 7, 55, 3, 2, 2, 2, 9, 60, 3, 2, 2, 2, 11, 64, 3, 2, 2, 2, 13, 71, 3, 2, 2, 2, 15, 77, 3, 2, 2, 2, 17, 82, 3, 2, 2, 2, 19, 88, 3, 2, 2, 2, 21, 90, 3, 2, 2, 2, 23, 92, 3, 2, 2, 2, 25, 94, 3, 2, 2, 2, 27, 96, 3, 2, 2, 2, 29, 98, 3, 2, 2, 2, 31, 100, 3, 2, 2, 2, 33, 102, 3, 2, 2, 2, 35, 105, 3, 2, 2, 2, 37, 110, 3, 2, 2, 2, 39, 138, 3, 2, 2, 2, 41, 143, 3, 2, 2, 2, 43, 149, 3, 2, 2, 2, 45, 151, 3, 2, 2, 2, 47, 48, 7, 107, 2, 2, 48, 49, 7, 104, 2, 2, 49, 4, 3, 2, 2, 2, 50, 51, 7, 118, 2, 2, 51, 52, 7, 106, 2, 2, 52, 53, 7, 103, 2, 2, 53, 54, 7, 112, 2, 2, 54, 6, 3, 2, 2, 2, 55, 56, 7, 103, 2, 2, 56, 57, 7, 110, 2, 2, 57, 58, 7, 117, 2, 2, 58, 59, 7, 103, 2, 2, 59, 8, 3, 2, 2, 2, 60, 61, 7, 103, 2, 2, 61, 62, 7, 112, 2, 2, 62, 63, 7, 102, 2, 2, 63, 10, 3, 2, 2, 2, 64, 65, 7, 116, 2, 2, 65, 66, 7, 103, 2, 2, 66, 67, 7, 114, 2, 2, 67, 68, 7, 103, 2, 2, 68, 69, 7, 99, 2, 2, 69, 70, 7, 118, 2, 2, 70, 12, 3, 2, 2, 2, 71, 72, 7, 119, 2, 2, 72, 73, 7, 112, 2, 2, 73, 74, 7, 118, 2, 2, 74, 75, 7, 107, 2, 2, 75, 76, 7, 110, 2, 2, 76, 14, 3, 2, 2, 2, 77, 78, 7, 116, 2, 2, 78, 79, 7, 103, 2, 2, 79, 80, 7, 99, 2, 2, 80, 81, 7, 102, 2, 2, 81, 16, 3, 2, 2, 2, 82, 83, 7, 121, 2, 2, 83, 84, 7, 116, 2, 2, 84, 85, 7, 107, 2, 2, 85, 86, 7, 118, 2, 2, 86, 87, 7, 103, 2, 2, 87, 18, 3, 2, 2, 2, 88, 89, 7, 42, 2, 2, 89, 20, 3, 2, 2, 2, 90, 91, 7, 43, 2, 2, 91, 22, 3, 2, 2, 2, 92, 93, 7, 45, 2, 2, 93, 24, 3, 2, 2, 2, 94, 95, 7, 47, 2, 2, 95, 26, 3, 2, 2, 2, 96, 97, 7, 44, 2, 2, 97, 28, 3, 2, 2, 2, 98, 99, 7, 49, 2, 2, 99, 30, 3, 2, 2, 2, 100, 101, 7, 62, 2, 2, 101, 32, 3, 2, 2, 2, 102, 103, 7, 63, 2, 2, 103, 34, 3, 2, 2, 2, 104, 106, 5, 45, 23, 2, 105, 104, 3, 2, 2, 2, 106, 107, 3, 2, 2, 2, 107, 105, 3, 2, 2, 2, 107, 108, 3, 2, 2, 2, 108, 36, 3, 2, 2, 2, 109, 111, 5, 43, 22, 2, 110, 109, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 112, 110, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 38, 3, 2, 2, 2, 114, 115, 7, 49, 2, 2, 115, 116, 7, 49, 2, 2, 116, 120, 3, 2, 2, 2, 117, 119, 10, 2, 2, 2, 118, 117, 3, 2, 2, 2, 119, 122, 3, 2, 2, 2, 120, 118, 3, 2, 2, 2, 120, 121, 3, 2, 2, 2, 121, 124, 3, 2, 2, 2, 122, 120, 3, 2, 2, 2, 123, 125, 7, 15, 2, 2, 124, 123, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 139, 7, 12, 2, 2, 127, 128, 7, 49, 2, 2, 128, 129, 7, 44, 2, 2, 129, 133, 3, 2, 2, 2, 130, 132, 11, 2, 2, 2, 131, 130, 3, 2, 2, 2, 132, 135, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 133, 131, 3, 2, 2, 2, 134, 136, 3, 2, 2, 2, 135, 133, 3, 2, 2, 2, 136, 137, 7, 44, 2, 2, 137, 139, 7, 49, 2, 2, 138, 114, 3, 2, 2, 2, 138, 127, 3, 2, 2, 2, 139, 140, 3, 2, 2, 2, 140, 141, 8, 20, 2, 2, 141, 40, 3, 2, 2, 2, 142, 144, 9, 3, 2, 2, 143, 142, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 143, 3, 2, 2, 2, 145, 146, 3, 2, 2, 2, 146, 147, 3, 2, 2, 2, 147, 148, 8, 21, 2, 2, 148, 42, 3, 2, 2, 2, 149, 150, 9, 4, 2, 2, 150, 44, 3, 2, 2, 2, 151, 152, 4, 50, 59, 2, 152, 46, 3, 2, 2, 2, 10, 2, 107, 112, 120, 124, 133, 138, 145, 3, 8, 2, 2]
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/TinyLexer.java b/Homework/cs5300/project-three/lexer/TinyLexer.java new file mode 100644 index 0000000..f1213fb --- /dev/null +++ b/Homework/cs5300/project-three/lexer/TinyLexer.java @@ -0,0 +1,164 @@ +// Generated from TinyLexer.tokens by ANTLR 4.9.1 +package lexer; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class TinyLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + IF=1, THEN=2, ELSE=3, END=4, REPEAT=5, UNTIL=6, READ=7, WRITE=8, OPAREN=9, + CPAREN=10, PLUS=11, MINUS=12, MULTIPLY=13, DIVIDE=14, LT=15, EQUAL=16, + NUM=17, ID=18, COMMENT=19, WS=20; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "IF", "THEN", "ELSE", "END", "REPEAT", "UNTIL", "READ", "WRITE", "OPAREN", + "CPAREN", "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "LT", "EQUAL", "NUM", + "ID", "COMMENT", "WS", "LETTER", "DIGIT" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'if'", "'then'", "'else'", "'end'", "'repeat'", "'until'", "'read'", + "'write'", "'('", "')'", "'+'", "'-'", "'*'", "'/'", "'<'", "'='" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "IF", "THEN", "ELSE", "END", "REPEAT", "UNTIL", "READ", "WRITE", + "OPAREN", "CPAREN", "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "LT", "EQUAL", + "NUM", "ID", "COMMENT", "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = "<INVALID>"; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public TinyLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "TinyLexer.tokens"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\26\u0099\b\1\4\2"+ + "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+ + "\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+ + "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\3\2\3\2\3\2\3"+ + "\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6"+ + "\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3"+ + "\t\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20"+ + "\3\20\3\21\3\21\3\22\6\22j\n\22\r\22\16\22k\3\23\6\23o\n\23\r\23\16\23"+ + "p\3\24\3\24\3\24\3\24\7\24w\n\24\f\24\16\24z\13\24\3\24\5\24}\n\24\3\24"+ + "\3\24\3\24\3\24\3\24\7\24\u0084\n\24\f\24\16\24\u0087\13\24\3\24\3\24"+ + "\5\24\u008b\n\24\3\24\3\24\3\25\6\25\u0090\n\25\r\25\16\25\u0091\3\25"+ + "\3\25\3\26\3\26\3\27\3\27\3\u0085\2\30\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21"+ + "\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\2-\2"+ + "\3\2\5\4\2\f\f\17\17\5\2\13\f\16\17\"\"\4\2C\\c|\2\u009d\2\3\3\2\2\2\2"+ + "\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2"+ + "\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2"+ + "\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2"+ + "\2\'\3\2\2\2\2)\3\2\2\2\3/\3\2\2\2\5\62\3\2\2\2\7\67\3\2\2\2\t<\3\2\2"+ + "\2\13@\3\2\2\2\rG\3\2\2\2\17M\3\2\2\2\21R\3\2\2\2\23X\3\2\2\2\25Z\3\2"+ + "\2\2\27\\\3\2\2\2\31^\3\2\2\2\33`\3\2\2\2\35b\3\2\2\2\37d\3\2\2\2!f\3"+ + "\2\2\2#i\3\2\2\2%n\3\2\2\2\'\u008a\3\2\2\2)\u008f\3\2\2\2+\u0095\3\2\2"+ + "\2-\u0097\3\2\2\2/\60\7k\2\2\60\61\7h\2\2\61\4\3\2\2\2\62\63\7v\2\2\63"+ + "\64\7j\2\2\64\65\7g\2\2\65\66\7p\2\2\66\6\3\2\2\2\678\7g\2\289\7n\2\2"+ + "9:\7u\2\2:;\7g\2\2;\b\3\2\2\2<=\7g\2\2=>\7p\2\2>?\7f\2\2?\n\3\2\2\2@A"+ + "\7t\2\2AB\7g\2\2BC\7r\2\2CD\7g\2\2DE\7c\2\2EF\7v\2\2F\f\3\2\2\2GH\7w\2"+ + "\2HI\7p\2\2IJ\7v\2\2JK\7k\2\2KL\7n\2\2L\16\3\2\2\2MN\7t\2\2NO\7g\2\2O"+ + "P\7c\2\2PQ\7f\2\2Q\20\3\2\2\2RS\7y\2\2ST\7t\2\2TU\7k\2\2UV\7v\2\2VW\7"+ + "g\2\2W\22\3\2\2\2XY\7*\2\2Y\24\3\2\2\2Z[\7+\2\2[\26\3\2\2\2\\]\7-\2\2"+ + "]\30\3\2\2\2^_\7/\2\2_\32\3\2\2\2`a\7,\2\2a\34\3\2\2\2bc\7\61\2\2c\36"+ + "\3\2\2\2de\7>\2\2e \3\2\2\2fg\7?\2\2g\"\3\2\2\2hj\5-\27\2ih\3\2\2\2jk"+ + "\3\2\2\2ki\3\2\2\2kl\3\2\2\2l$\3\2\2\2mo\5+\26\2nm\3\2\2\2op\3\2\2\2p"+ + "n\3\2\2\2pq\3\2\2\2q&\3\2\2\2rs\7\61\2\2st\7\61\2\2tx\3\2\2\2uw\n\2\2"+ + "\2vu\3\2\2\2wz\3\2\2\2xv\3\2\2\2xy\3\2\2\2y|\3\2\2\2zx\3\2\2\2{}\7\17"+ + "\2\2|{\3\2\2\2|}\3\2\2\2}~\3\2\2\2~\u008b\7\f\2\2\177\u0080\7\61\2\2\u0080"+ + "\u0081\7,\2\2\u0081\u0085\3\2\2\2\u0082\u0084\13\2\2\2\u0083\u0082\3\2"+ + "\2\2\u0084\u0087\3\2\2\2\u0085\u0086\3\2\2\2\u0085\u0083\3\2\2\2\u0086"+ + "\u0088\3\2\2\2\u0087\u0085\3\2\2\2\u0088\u0089\7,\2\2\u0089\u008b\7\61"+ + "\2\2\u008ar\3\2\2\2\u008a\177\3\2\2\2\u008b\u008c\3\2\2\2\u008c\u008d"+ + "\b\24\2\2\u008d(\3\2\2\2\u008e\u0090\t\3\2\2\u008f\u008e\3\2\2\2\u0090"+ + "\u0091\3\2\2\2\u0091\u008f\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0093\3\2"+ + "\2\2\u0093\u0094\b\25\2\2\u0094*\3\2\2\2\u0095\u0096\t\4\2\2\u0096,\3"+ + "\2\2\2\u0097\u0098\4\62;\2\u0098.\3\2\2\2\n\2kpx|\u0085\u008a\u0091\3"+ + "\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +}
\ No newline at end of file diff --git a/Homework/cs5300/project-three/lexer/TinyLexer.tokens b/Homework/cs5300/project-three/lexer/TinyLexer.tokens new file mode 100644 index 0000000..2d6fdc7 --- /dev/null +++ b/Homework/cs5300/project-three/lexer/TinyLexer.tokens @@ -0,0 +1,36 @@ +IF=1 +THEN=2 +ELSE=3 +END=4 +REPEAT=5 +UNTIL=6 +READ=7 +WRITE=8 +OPAREN=9 +CPAREN=10 +PLUS=11 +MINUS=12 +MULTIPLY=13 +DIVIDE=14 +LT=15 +EQUAL=16 +NUM=17 +ID=18 +COMMENT=19 +WS=20 +'if'=1 +'then'=2 +'else'=3 +'end'=4 +'repeat'=5 +'until'=6 +'read'=7 +'write'=8 +'('=9 +')'=10 +'+'=11 +'-'=12 +'*'=13 +'/'=14 +'<'=15 +'='=16 |
