diff --git a/README.md b/README.md index c503c32..8d82b1e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,42 @@ -# Run the interpreter +# Run it `java -jar WHILEParser.jar ...` -# Build it yourself +# Build it ## create parser with antlr `antlr4 -package parser.grammar -o main/java/parser/grammar -no-listener -visitor Loop.g4` ## create executable -`mvn clean compile assembly:single` \ No newline at end of file +`mvn clean compile assembly:single` + +# Language Example +`//addWithWhile.txt +x0 = x2; // this is a comment +WHILE x1 != 0 DO +x0 = x0 +1; +x1 = x1 - 1; +END` + +`//mulWithLoop.txt +z1 = x1; +z2 = x2; +x0 = 0; +y0 = 1; +LOOP z2 DO + x1 = z1; + x2 = y0 - 1; + x3 = x0; + y10 = y0; + z11 = x1; + z12 = x3; + x0 = x1; + y0 = 1; + LOOP z12 DO + x1 = z11; + x2 = y0 - 1; + x3 = x0; + x0 = x3 + 1; + y0 = y0 + 1; + END + y0 = y10; + y0 = y0 + 1; +END` diff --git a/WHILEParser.jar b/WHILEParser.jar index 3dfd63b..c504ecb 100644 Binary files a/WHILEParser.jar and b/WHILEParser.jar differ diff --git a/src/Loop.g4 b/src/Loop.g4 index 28fbb43..c520f10 100644 --- a/src/Loop.g4 +++ b/src/Loop.g4 @@ -16,5 +16,5 @@ prog: asrt #Asert INT: [0-9]+ ; NEWLINE : [\r\n]+ -> skip; -LEER: ' ' -> skip; +LEER: [ \t]+ -> skip; LINE_COMMENT: '//' ~[\r\n]* -> skip; \ No newline at end of file diff --git a/src/main/java/parser/grammar/Loop.interp b/src/main/java/parser/grammar/Loop.interp index 2793106..7bd7a83 100644 --- a/src/main/java/parser/grammar/Loop.interp +++ b/src/main/java/parser/grammar/Loop.interp @@ -12,7 +12,7 @@ null null null null -' ' +null null token symbolic names: diff --git a/src/main/java/parser/grammar/Loop.tokens b/src/main/java/parser/grammar/Loop.tokens index 3220f5a..0d1f680 100644 --- a/src/main/java/parser/grammar/Loop.tokens +++ b/src/main/java/parser/grammar/Loop.tokens @@ -21,4 +21,3 @@ LINE_COMMENT=14 'END'=7 'WHILE'=8 '!='=9 -' '=13 diff --git a/src/main/java/parser/grammar/LoopLexer.interp b/src/main/java/parser/grammar/LoopLexer.interp index 8c629db..92aa507 100644 --- a/src/main/java/parser/grammar/LoopLexer.interp +++ b/src/main/java/parser/grammar/LoopLexer.interp @@ -12,7 +12,7 @@ null null null null -' ' +null null token symbolic names: @@ -56,4 +56,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 14, 88, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 4, 10, 63, 8, 10, 11, 10, 12, 10, 64, 1, 11, 4, 11, 68, 8, 11, 11, 11, 12, 11, 69, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 82, 8, 13, 10, 13, 12, 13, 85, 9, 13, 1, 13, 1, 13, 0, 0, 14, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 1, 0, 2, 1, 0, 48, 57, 2, 0, 10, 10, 13, 13, 90, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 1, 29, 1, 0, 0, 0, 3, 31, 1, 0, 0, 0, 5, 33, 1, 0, 0, 0, 7, 35, 1, 0, 0, 0, 9, 37, 1, 0, 0, 0, 11, 42, 1, 0, 0, 0, 13, 45, 1, 0, 0, 0, 15, 49, 1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 58, 1, 0, 0, 0, 21, 62, 1, 0, 0, 0, 23, 67, 1, 0, 0, 0, 25, 73, 1, 0, 0, 0, 27, 77, 1, 0, 0, 0, 29, 30, 5, 43, 0, 0, 30, 2, 1, 0, 0, 0, 31, 32, 5, 45, 0, 0, 32, 4, 1, 0, 0, 0, 33, 34, 5, 61, 0, 0, 34, 6, 1, 0, 0, 0, 35, 36, 5, 59, 0, 0, 36, 8, 1, 0, 0, 0, 37, 38, 5, 76, 0, 0, 38, 39, 5, 79, 0, 0, 39, 40, 5, 79, 0, 0, 40, 41, 5, 80, 0, 0, 41, 10, 1, 0, 0, 0, 42, 43, 5, 68, 0, 0, 43, 44, 5, 79, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46, 5, 69, 0, 0, 46, 47, 5, 78, 0, 0, 47, 48, 5, 68, 0, 0, 48, 14, 1, 0, 0, 0, 49, 50, 5, 87, 0, 0, 50, 51, 5, 72, 0, 0, 51, 52, 5, 73, 0, 0, 52, 53, 5, 76, 0, 0, 53, 54, 5, 69, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 33, 0, 0, 56, 57, 5, 61, 0, 0, 57, 18, 1, 0, 0, 0, 58, 59, 2, 120, 122, 0, 59, 60, 3, 21, 10, 0, 60, 20, 1, 0, 0, 0, 61, 63, 7, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 22, 1, 0, 0, 0, 66, 68, 7, 1, 0, 0, 67, 66, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 6, 11, 0, 0, 72, 24, 1, 0, 0, 0, 73, 74, 5, 32, 0, 0, 74, 75, 1, 0, 0, 0, 75, 76, 6, 12, 0, 0, 76, 26, 1, 0, 0, 0, 77, 78, 5, 47, 0, 0, 78, 79, 5, 47, 0, 0, 79, 83, 1, 0, 0, 0, 80, 82, 8, 1, 0, 0, 81, 80, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 87, 6, 13, 0, 0, 87, 28, 1, 0, 0, 0, 4, 0, 64, 69, 83, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 14, 91, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 4, 10, 63, 8, 10, 11, 10, 12, 10, 64, 1, 11, 4, 11, 68, 8, 11, 11, 11, 12, 11, 69, 1, 11, 1, 11, 1, 12, 4, 12, 75, 8, 12, 11, 12, 12, 12, 76, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 85, 8, 13, 10, 13, 12, 13, 88, 9, 13, 1, 13, 1, 13, 0, 0, 14, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 1, 0, 3, 1, 0, 48, 57, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 94, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 1, 29, 1, 0, 0, 0, 3, 31, 1, 0, 0, 0, 5, 33, 1, 0, 0, 0, 7, 35, 1, 0, 0, 0, 9, 37, 1, 0, 0, 0, 11, 42, 1, 0, 0, 0, 13, 45, 1, 0, 0, 0, 15, 49, 1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 58, 1, 0, 0, 0, 21, 62, 1, 0, 0, 0, 23, 67, 1, 0, 0, 0, 25, 74, 1, 0, 0, 0, 27, 80, 1, 0, 0, 0, 29, 30, 5, 43, 0, 0, 30, 2, 1, 0, 0, 0, 31, 32, 5, 45, 0, 0, 32, 4, 1, 0, 0, 0, 33, 34, 5, 61, 0, 0, 34, 6, 1, 0, 0, 0, 35, 36, 5, 59, 0, 0, 36, 8, 1, 0, 0, 0, 37, 38, 5, 76, 0, 0, 38, 39, 5, 79, 0, 0, 39, 40, 5, 79, 0, 0, 40, 41, 5, 80, 0, 0, 41, 10, 1, 0, 0, 0, 42, 43, 5, 68, 0, 0, 43, 44, 5, 79, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46, 5, 69, 0, 0, 46, 47, 5, 78, 0, 0, 47, 48, 5, 68, 0, 0, 48, 14, 1, 0, 0, 0, 49, 50, 5, 87, 0, 0, 50, 51, 5, 72, 0, 0, 51, 52, 5, 73, 0, 0, 52, 53, 5, 76, 0, 0, 53, 54, 5, 69, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 33, 0, 0, 56, 57, 5, 61, 0, 0, 57, 18, 1, 0, 0, 0, 58, 59, 2, 120, 122, 0, 59, 60, 3, 21, 10, 0, 60, 20, 1, 0, 0, 0, 61, 63, 7, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 22, 1, 0, 0, 0, 66, 68, 7, 1, 0, 0, 67, 66, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 6, 11, 0, 0, 72, 24, 1, 0, 0, 0, 73, 75, 7, 2, 0, 0, 74, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 6, 12, 0, 0, 79, 26, 1, 0, 0, 0, 80, 81, 5, 47, 0, 0, 81, 82, 5, 47, 0, 0, 82, 86, 1, 0, 0, 0, 83, 85, 8, 1, 0, 0, 84, 83, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 89, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 90, 6, 13, 0, 0, 90, 28, 1, 0, 0, 0, 5, 0, 64, 69, 76, 86, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/main/java/parser/grammar/LoopLexer.java b/src/main/java/parser/grammar/LoopLexer.java index 237d1f4..65c78fd 100644 --- a/src/main/java/parser/grammar/LoopLexer.java +++ b/src/main/java/parser/grammar/LoopLexer.java @@ -38,7 +38,7 @@ public class LoopLexer extends Lexer { private static String[] makeLiteralNames() { return new String[] { null, "'+'", "'-'", "'='", "';'", "'LOOP'", "'DO'", "'END'", "'WHILE'", - "'!='", null, null, null, "' '" + "'!='" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); @@ -107,7 +107,7 @@ public class LoopLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\u0004\u0000\u000eX\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ + "\u0004\u0000\u000e[\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ "\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+ "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+ "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+ @@ -118,46 +118,48 @@ public class LoopLexer extends Lexer { "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001"+ "\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\n\u0004\n?\b\n\u000b"+ "\n\f\n@\u0001\u000b\u0004\u000bD\b\u000b\u000b\u000b\f\u000bE\u0001\u000b"+ - "\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001"+ - "\r\u0005\rR\b\r\n\r\f\rU\t\r\u0001\r\u0001\r\u0000\u0000\u000e\u0001\u0001"+ - "\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f"+ - "\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u0001\u0000"+ - "\u0002\u0001\u000009\u0002\u0000\n\n\r\rZ\u0000\u0001\u0001\u0000\u0000"+ - "\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000"+ - "\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000"+ - "\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000"+ - "\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000"+ - "\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000"+ - "\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000"+ - "\u001b\u0001\u0000\u0000\u0000\u0001\u001d\u0001\u0000\u0000\u0000\u0003"+ - "\u001f\u0001\u0000\u0000\u0000\u0005!\u0001\u0000\u0000\u0000\u0007#\u0001"+ - "\u0000\u0000\u0000\t%\u0001\u0000\u0000\u0000\u000b*\u0001\u0000\u0000"+ - "\u0000\r-\u0001\u0000\u0000\u0000\u000f1\u0001\u0000\u0000\u0000\u0011"+ - "7\u0001\u0000\u0000\u0000\u0013:\u0001\u0000\u0000\u0000\u0015>\u0001"+ - "\u0000\u0000\u0000\u0017C\u0001\u0000\u0000\u0000\u0019I\u0001\u0000\u0000"+ - "\u0000\u001bM\u0001\u0000\u0000\u0000\u001d\u001e\u0005+\u0000\u0000\u001e"+ - "\u0002\u0001\u0000\u0000\u0000\u001f \u0005-\u0000\u0000 \u0004\u0001"+ - "\u0000\u0000\u0000!\"\u0005=\u0000\u0000\"\u0006\u0001\u0000\u0000\u0000"+ - "#$\u0005;\u0000\u0000$\b\u0001\u0000\u0000\u0000%&\u0005L\u0000\u0000"+ - "&\'\u0005O\u0000\u0000\'(\u0005O\u0000\u0000()\u0005P\u0000\u0000)\n\u0001"+ - "\u0000\u0000\u0000*+\u0005D\u0000\u0000+,\u0005O\u0000\u0000,\f\u0001"+ - "\u0000\u0000\u0000-.\u0005E\u0000\u0000./\u0005N\u0000\u0000/0\u0005D"+ - "\u0000\u00000\u000e\u0001\u0000\u0000\u000012\u0005W\u0000\u000023\u0005"+ - "H\u0000\u000034\u0005I\u0000\u000045\u0005L\u0000\u000056\u0005E\u0000"+ - "\u00006\u0010\u0001\u0000\u0000\u000078\u0005!\u0000\u000089\u0005=\u0000"+ - "\u00009\u0012\u0001\u0000\u0000\u0000:;\u0002xz\u0000;<\u0003\u0015\n"+ - "\u0000<\u0014\u0001\u0000\u0000\u0000=?\u0007\u0000\u0000\u0000>=\u0001"+ - "\u0000\u0000\u0000?@\u0001\u0000\u0000\u0000@>\u0001\u0000\u0000\u0000"+ - "@A\u0001\u0000\u0000\u0000A\u0016\u0001\u0000\u0000\u0000BD\u0007\u0001"+ - "\u0000\u0000CB\u0001\u0000\u0000\u0000DE\u0001\u0000\u0000\u0000EC\u0001"+ - "\u0000\u0000\u0000EF\u0001\u0000\u0000\u0000FG\u0001\u0000\u0000\u0000"+ - "GH\u0006\u000b\u0000\u0000H\u0018\u0001\u0000\u0000\u0000IJ\u0005 \u0000"+ - "\u0000JK\u0001\u0000\u0000\u0000KL\u0006\f\u0000\u0000L\u001a\u0001\u0000"+ - "\u0000\u0000MN\u0005/\u0000\u0000NO\u0005/\u0000\u0000OS\u0001\u0000\u0000"+ - "\u0000PR\b\u0001\u0000\u0000QP\u0001\u0000\u0000\u0000RU\u0001\u0000\u0000"+ - "\u0000SQ\u0001\u0000\u0000\u0000ST\u0001\u0000\u0000\u0000TV\u0001\u0000"+ - "\u0000\u0000US\u0001\u0000\u0000\u0000VW\u0006\r\u0000\u0000W\u001c\u0001"+ - "\u0000\u0000\u0000\u0004\u0000@ES\u0001\u0006\u0000\u0000"; + "\u0001\u000b\u0001\f\u0004\fK\b\f\u000b\f\f\fL\u0001\f\u0001\f\u0001\r"+ + "\u0001\r\u0001\r\u0001\r\u0005\rU\b\r\n\r\f\rX\t\r\u0001\r\u0001\r\u0000"+ + "\u0000\u000e\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b"+ + "\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b"+ + "\u000e\u0001\u0000\u0003\u0001\u000009\u0002\u0000\n\n\r\r\u0002\u0000"+ + "\t\t ^\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000"+ + "\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000"+ + "\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000"+ + "\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000"+ + "\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000"+ + "\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000"+ + "\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0001"+ + "\u001d\u0001\u0000\u0000\u0000\u0003\u001f\u0001\u0000\u0000\u0000\u0005"+ + "!\u0001\u0000\u0000\u0000\u0007#\u0001\u0000\u0000\u0000\t%\u0001\u0000"+ + "\u0000\u0000\u000b*\u0001\u0000\u0000\u0000\r-\u0001\u0000\u0000\u0000"+ + "\u000f1\u0001\u0000\u0000\u0000\u00117\u0001\u0000\u0000\u0000\u0013:"+ + "\u0001\u0000\u0000\u0000\u0015>\u0001\u0000\u0000\u0000\u0017C\u0001\u0000"+ + "\u0000\u0000\u0019J\u0001\u0000\u0000\u0000\u001bP\u0001\u0000\u0000\u0000"+ + "\u001d\u001e\u0005+\u0000\u0000\u001e\u0002\u0001\u0000\u0000\u0000\u001f"+ + " \u0005-\u0000\u0000 \u0004\u0001\u0000\u0000\u0000!\"\u0005=\u0000\u0000"+ + "\"\u0006\u0001\u0000\u0000\u0000#$\u0005;\u0000\u0000$\b\u0001\u0000\u0000"+ + "\u0000%&\u0005L\u0000\u0000&\'\u0005O\u0000\u0000\'(\u0005O\u0000\u0000"+ + "()\u0005P\u0000\u0000)\n\u0001\u0000\u0000\u0000*+\u0005D\u0000\u0000"+ + "+,\u0005O\u0000\u0000,\f\u0001\u0000\u0000\u0000-.\u0005E\u0000\u0000"+ + "./\u0005N\u0000\u0000/0\u0005D\u0000\u00000\u000e\u0001\u0000\u0000\u0000"+ + "12\u0005W\u0000\u000023\u0005H\u0000\u000034\u0005I\u0000\u000045\u0005"+ + "L\u0000\u000056\u0005E\u0000\u00006\u0010\u0001\u0000\u0000\u000078\u0005"+ + "!\u0000\u000089\u0005=\u0000\u00009\u0012\u0001\u0000\u0000\u0000:;\u0002"+ + "xz\u0000;<\u0003\u0015\n\u0000<\u0014\u0001\u0000\u0000\u0000=?\u0007"+ + "\u0000\u0000\u0000>=\u0001\u0000\u0000\u0000?@\u0001\u0000\u0000\u0000"+ + "@>\u0001\u0000\u0000\u0000@A\u0001\u0000\u0000\u0000A\u0016\u0001\u0000"+ + "\u0000\u0000BD\u0007\u0001\u0000\u0000CB\u0001\u0000\u0000\u0000DE\u0001"+ + "\u0000\u0000\u0000EC\u0001\u0000\u0000\u0000EF\u0001\u0000\u0000\u0000"+ + "FG\u0001\u0000\u0000\u0000GH\u0006\u000b\u0000\u0000H\u0018\u0001\u0000"+ + "\u0000\u0000IK\u0007\u0002\u0000\u0000JI\u0001\u0000\u0000\u0000KL\u0001"+ + "\u0000\u0000\u0000LJ\u0001\u0000\u0000\u0000LM\u0001\u0000\u0000\u0000"+ + "MN\u0001\u0000\u0000\u0000NO\u0006\f\u0000\u0000O\u001a\u0001\u0000\u0000"+ + "\u0000PQ\u0005/\u0000\u0000QR\u0005/\u0000\u0000RV\u0001\u0000\u0000\u0000"+ + "SU\b\u0001\u0000\u0000TS\u0001\u0000\u0000\u0000UX\u0001\u0000\u0000\u0000"+ + "VT\u0001\u0000\u0000\u0000VW\u0001\u0000\u0000\u0000WY\u0001\u0000\u0000"+ + "\u0000XV\u0001\u0000\u0000\u0000YZ\u0006\r\u0000\u0000Z\u001c\u0001\u0000"+ + "\u0000\u0000\u0005\u0000@ELV\u0001\u0006\u0000\u0000"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/parser/grammar/LoopLexer.tokens b/src/main/java/parser/grammar/LoopLexer.tokens index 3220f5a..0d1f680 100644 --- a/src/main/java/parser/grammar/LoopLexer.tokens +++ b/src/main/java/parser/grammar/LoopLexer.tokens @@ -21,4 +21,3 @@ LINE_COMMENT=14 'END'=7 'WHILE'=8 '!='=9 -' '=13 diff --git a/src/main/java/parser/grammar/LoopParser.java b/src/main/java/parser/grammar/LoopParser.java index 8d7dfe5..f4d46e6 100644 --- a/src/main/java/parser/grammar/LoopParser.java +++ b/src/main/java/parser/grammar/LoopParser.java @@ -31,7 +31,7 @@ public class LoopParser extends Parser { private static String[] makeLiteralNames() { return new String[] { null, "'+'", "'-'", "'='", "';'", "'LOOP'", "'DO'", "'END'", "'WHILE'", - "'!='", null, null, null, "' '" + "'!='" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames();