diff --git a/src/main/java/lexer/StupsLexer.interp b/src/main/java/lexer/StupsLexer.interp new file mode 100644 index 0000000..d4aafe4 --- /dev/null +++ b/src/main/java/lexer/StupsLexer.interp @@ -0,0 +1,150 @@ +token literal names: +null +null +null +null +'class' +'public' +'static' +'void' +'boolean' +'String' +'if' +'else' +'while' +'System.out.println' +'=' +'+' +'-' +'*' +'/' +'%' +'!' +'&&' +'||' +'==' +'!=' +'<' +'<=' +'>' +'>=' +'(' +')' +'{' +'}' +'[' +']' +';' +',' +'.' +null +null +null +null + +token symbolic names: +null +WHITESPACE +MULTILINE_COMMENT +LINE_COMMENT +CLASS +PUBLIC +STATIC +VOID_TYPE +BOOLEAN_TYPE +STRING_TYPE +IF +ELSE +WHILE +PRINTLN +ASSIGN +ADD +SUB +MUL +DIV +MOD +NOT +AND +OR +EQUAL +NOT_EQUAL +LESS +LESS_EQUAL +GREATER +GREATER_EQUAL +L_PAREN +R_PAREN +L_BRACE +R_BRACE +L_BRACKET +R_BRACKET +SEMICOLON +COMMA +DOT +INTEGER_LIT +STRING_LIT +BOOLEAN_LIT +IDENTIFIER + +rule names: +FIRST_DIGIT +DIGIT +LOWERCASE +UPPERCASE +LETTER +LETTER_DIGIT +WHITE +ANY +ANY_NOBREAK +ANY_NOWHITE +WHITESPACE +MULTILINE_COMMENT +LINE_COMMENT +CLASS +PUBLIC +STATIC +VOID_TYPE +BOOLEAN_TYPE +STRING_TYPE +IF +ELSE +WHILE +PRINTLN +ASSIGN +ADD +SUB +MUL +DIV +MOD +NOT +AND +OR +EQUAL +NOT_EQUAL +LESS +LESS_EQUAL +GREATER +GREATER_EQUAL +L_PAREN +R_PAREN +L_BRACE +R_BRACE +L_BRACKET +R_BRACKET +SEMICOLON +COMMA +DOT +INTEGER_LIT +STRING_LIT +BOOLEAN_LIT +IDENTIFIER + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 43, 323, 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, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 5, 6, 116, 10, 6, 3, 7, 3, 7, 5, 7, 120, 10, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 6, 12, 131, 10, 12, 13, 12, 14, 12, 132, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 141, 10, 13, 12, 13, 14, 13, 144, 11, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 7, 14, 155, 10, 14, 12, 14, 14, 14, 158, 11, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 41, 3, 41, 3, 42, 3, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 5, 49, 290, 10, 49, 3, 49, 6, 49, 293, 10, 49, 13, 49, 14, 49, 294, 3, 50, 3, 50, 7, 50, 299, 10, 50, 12, 50, 14, 50, 302, 11, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 315, 10, 51, 3, 52, 3, 52, 7, 52, 319, 10, 52, 12, 52, 14, 52, 322, 11, 52, 2, 2, 53, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2, 17, 2, 19, 2, 21, 2, 23, 3, 25, 4, 27, 5, 29, 6, 31, 7, 33, 8, 35, 9, 37, 10, 39, 11, 41, 12, 43, 13, 45, 14, 47, 15, 49, 16, 51, 17, 53, 18, 55, 19, 57, 20, 59, 21, 61, 22, 63, 23, 65, 24, 67, 25, 69, 26, 71, 27, 73, 28, 75, 29, 77, 30, 79, 31, 81, 32, 83, 33, 85, 34, 87, 35, 89, 36, 91, 37, 93, 38, 95, 39, 97, 40, 99, 41, 101, 42, 103, 43, 3, 2, 9, 3, 2, 51, 59, 3, 2, 50, 59, 3, 2, 99, 124, 3, 2, 67, 92, 5, 2, 11, 12, 15, 15, 34, 34, 3, 2, 2, 129, 4, 2, 12, 12, 15, 15, 2, 322, 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, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 3, 105, 3, 2, 2, 2, 5, 107, 3, 2, 2, 2, 7, 109, 3, 2, 2, 2, 9, 111, 3, 2, 2, 2, 11, 115, 3, 2, 2, 2, 13, 119, 3, 2, 2, 2, 15, 121, 3, 2, 2, 2, 17, 123, 3, 2, 2, 2, 19, 125, 3, 2, 2, 2, 21, 127, 3, 2, 2, 2, 23, 130, 3, 2, 2, 2, 25, 136, 3, 2, 2, 2, 27, 150, 3, 2, 2, 2, 29, 161, 3, 2, 2, 2, 31, 167, 3, 2, 2, 2, 33, 174, 3, 2, 2, 2, 35, 181, 3, 2, 2, 2, 37, 186, 3, 2, 2, 2, 39, 194, 3, 2, 2, 2, 41, 201, 3, 2, 2, 2, 43, 204, 3, 2, 2, 2, 45, 209, 3, 2, 2, 2, 47, 215, 3, 2, 2, 2, 49, 234, 3, 2, 2, 2, 51, 236, 3, 2, 2, 2, 53, 238, 3, 2, 2, 2, 55, 240, 3, 2, 2, 2, 57, 242, 3, 2, 2, 2, 59, 244, 3, 2, 2, 2, 61, 246, 3, 2, 2, 2, 63, 248, 3, 2, 2, 2, 65, 251, 3, 2, 2, 2, 67, 254, 3, 2, 2, 2, 69, 257, 3, 2, 2, 2, 71, 260, 3, 2, 2, 2, 73, 262, 3, 2, 2, 2, 75, 265, 3, 2, 2, 2, 77, 267, 3, 2, 2, 2, 79, 270, 3, 2, 2, 2, 81, 272, 3, 2, 2, 2, 83, 274, 3, 2, 2, 2, 85, 276, 3, 2, 2, 2, 87, 278, 3, 2, 2, 2, 89, 280, 3, 2, 2, 2, 91, 282, 3, 2, 2, 2, 93, 284, 3, 2, 2, 2, 95, 286, 3, 2, 2, 2, 97, 289, 3, 2, 2, 2, 99, 296, 3, 2, 2, 2, 101, 314, 3, 2, 2, 2, 103, 316, 3, 2, 2, 2, 105, 106, 9, 2, 2, 2, 106, 4, 3, 2, 2, 2, 107, 108, 9, 3, 2, 2, 108, 6, 3, 2, 2, 2, 109, 110, 9, 4, 2, 2, 110, 8, 3, 2, 2, 2, 111, 112, 9, 5, 2, 2, 112, 10, 3, 2, 2, 2, 113, 116, 5, 7, 4, 2, 114, 116, 5, 9, 5, 2, 115, 113, 3, 2, 2, 2, 115, 114, 3, 2, 2, 2, 116, 12, 3, 2, 2, 2, 117, 120, 5, 11, 6, 2, 118, 120, 5, 5, 3, 2, 119, 117, 3, 2, 2, 2, 119, 118, 3, 2, 2, 2, 120, 14, 3, 2, 2, 2, 121, 122, 9, 6, 2, 2, 122, 16, 3, 2, 2, 2, 123, 124, 9, 7, 2, 2, 124, 18, 3, 2, 2, 2, 125, 126, 10, 8, 2, 2, 126, 20, 3, 2, 2, 2, 127, 128, 10, 6, 2, 2, 128, 22, 3, 2, 2, 2, 129, 131, 5, 15, 8, 2, 130, 129, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 130, 3, 2, 2, 2, 132, 133, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 8, 12, 2, 2, 135, 24, 3, 2, 2, 2, 136, 137, 7, 49, 2, 2, 137, 138, 7, 44, 2, 2, 138, 142, 3, 2, 2, 2, 139, 141, 5, 17, 9, 2, 140, 139, 3, 2, 2, 2, 141, 144, 3, 2, 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 3, 2, 2, 2, 144, 142, 3, 2, 2, 2, 145, 146, 7, 44, 2, 2, 146, 147, 7, 49, 2, 2, 147, 148, 3, 2, 2, 2, 148, 149, 8, 13, 2, 2, 149, 26, 3, 2, 2, 2, 150, 151, 7, 49, 2, 2, 151, 152, 7, 49, 2, 2, 152, 156, 3, 2, 2, 2, 153, 155, 5, 19, 10, 2, 154, 153, 3, 2, 2, 2, 155, 158, 3, 2, 2, 2, 156, 154, 3, 2, 2, 2, 156, 157, 3, 2, 2, 2, 157, 159, 3, 2, 2, 2, 158, 156, 3, 2, 2, 2, 159, 160, 8, 14, 2, 2, 160, 28, 3, 2, 2, 2, 161, 162, 7, 101, 2, 2, 162, 163, 7, 110, 2, 2, 163, 164, 7, 99, 2, 2, 164, 165, 7, 117, 2, 2, 165, 166, 7, 117, 2, 2, 166, 30, 3, 2, 2, 2, 167, 168, 7, 114, 2, 2, 168, 169, 7, 119, 2, 2, 169, 170, 7, 100, 2, 2, 170, 171, 7, 110, 2, 2, 171, 172, 7, 107, 2, 2, 172, 173, 7, 101, 2, 2, 173, 32, 3, 2, 2, 2, 174, 175, 7, 117, 2, 2, 175, 176, 7, 118, 2, 2, 176, 177, 7, 99, 2, 2, 177, 178, 7, 118, 2, 2, 178, 179, 7, 107, 2, 2, 179, 180, 7, 101, 2, 2, 180, 34, 3, 2, 2, 2, 181, 182, 7, 120, 2, 2, 182, 183, 7, 113, 2, 2, 183, 184, 7, 107, 2, 2, 184, 185, 7, 102, 2, 2, 185, 36, 3, 2, 2, 2, 186, 187, 7, 100, 2, 2, 187, 188, 7, 113, 2, 2, 188, 189, 7, 113, 2, 2, 189, 190, 7, 110, 2, 2, 190, 191, 7, 103, 2, 2, 191, 192, 7, 99, 2, 2, 192, 193, 7, 112, 2, 2, 193, 38, 3, 2, 2, 2, 194, 195, 7, 85, 2, 2, 195, 196, 7, 118, 2, 2, 196, 197, 7, 116, 2, 2, 197, 198, 7, 107, 2, 2, 198, 199, 7, 112, 2, 2, 199, 200, 7, 105, 2, 2, 200, 40, 3, 2, 2, 2, 201, 202, 7, 107, 2, 2, 202, 203, 7, 104, 2, 2, 203, 42, 3, 2, 2, 2, 204, 205, 7, 103, 2, 2, 205, 206, 7, 110, 2, 2, 206, 207, 7, 117, 2, 2, 207, 208, 7, 103, 2, 2, 208, 44, 3, 2, 2, 2, 209, 210, 7, 121, 2, 2, 210, 211, 7, 106, 2, 2, 211, 212, 7, 107, 2, 2, 212, 213, 7, 110, 2, 2, 213, 214, 7, 103, 2, 2, 214, 46, 3, 2, 2, 2, 215, 216, 7, 85, 2, 2, 216, 217, 7, 123, 2, 2, 217, 218, 7, 117, 2, 2, 218, 219, 7, 118, 2, 2, 219, 220, 7, 103, 2, 2, 220, 221, 7, 111, 2, 2, 221, 222, 7, 48, 2, 2, 222, 223, 7, 113, 2, 2, 223, 224, 7, 119, 2, 2, 224, 225, 7, 118, 2, 2, 225, 226, 7, 48, 2, 2, 226, 227, 7, 114, 2, 2, 227, 228, 7, 116, 2, 2, 228, 229, 7, 107, 2, 2, 229, 230, 7, 112, 2, 2, 230, 231, 7, 118, 2, 2, 231, 232, 7, 110, 2, 2, 232, 233, 7, 112, 2, 2, 233, 48, 3, 2, 2, 2, 234, 235, 7, 63, 2, 2, 235, 50, 3, 2, 2, 2, 236, 237, 7, 45, 2, 2, 237, 52, 3, 2, 2, 2, 238, 239, 7, 47, 2, 2, 239, 54, 3, 2, 2, 2, 240, 241, 7, 44, 2, 2, 241, 56, 3, 2, 2, 2, 242, 243, 7, 49, 2, 2, 243, 58, 3, 2, 2, 2, 244, 245, 7, 39, 2, 2, 245, 60, 3, 2, 2, 2, 246, 247, 7, 35, 2, 2, 247, 62, 3, 2, 2, 2, 248, 249, 7, 40, 2, 2, 249, 250, 7, 40, 2, 2, 250, 64, 3, 2, 2, 2, 251, 252, 7, 126, 2, 2, 252, 253, 7, 126, 2, 2, 253, 66, 3, 2, 2, 2, 254, 255, 7, 63, 2, 2, 255, 256, 7, 63, 2, 2, 256, 68, 3, 2, 2, 2, 257, 258, 7, 35, 2, 2, 258, 259, 7, 63, 2, 2, 259, 70, 3, 2, 2, 2, 260, 261, 7, 62, 2, 2, 261, 72, 3, 2, 2, 2, 262, 263, 7, 62, 2, 2, 263, 264, 7, 63, 2, 2, 264, 74, 3, 2, 2, 2, 265, 266, 7, 64, 2, 2, 266, 76, 3, 2, 2, 2, 267, 268, 7, 64, 2, 2, 268, 269, 7, 63, 2, 2, 269, 78, 3, 2, 2, 2, 270, 271, 7, 42, 2, 2, 271, 80, 3, 2, 2, 2, 272, 273, 7, 43, 2, 2, 273, 82, 3, 2, 2, 2, 274, 275, 7, 125, 2, 2, 275, 84, 3, 2, 2, 2, 276, 277, 7, 127, 2, 2, 277, 86, 3, 2, 2, 2, 278, 279, 7, 93, 2, 2, 279, 88, 3, 2, 2, 2, 280, 281, 7, 95, 2, 2, 281, 90, 3, 2, 2, 2, 282, 283, 7, 61, 2, 2, 283, 92, 3, 2, 2, 2, 284, 285, 7, 46, 2, 2, 285, 94, 3, 2, 2, 2, 286, 287, 7, 48, 2, 2, 287, 96, 3, 2, 2, 2, 288, 290, 7, 47, 2, 2, 289, 288, 3, 2, 2, 2, 289, 290, 3, 2, 2, 2, 290, 292, 3, 2, 2, 2, 291, 293, 5, 5, 3, 2, 292, 291, 3, 2, 2, 2, 293, 294, 3, 2, 2, 2, 294, 292, 3, 2, 2, 2, 294, 295, 3, 2, 2, 2, 295, 98, 3, 2, 2, 2, 296, 300, 7, 36, 2, 2, 297, 299, 5, 19, 10, 2, 298, 297, 3, 2, 2, 2, 299, 302, 3, 2, 2, 2, 300, 298, 3, 2, 2, 2, 300, 301, 3, 2, 2, 2, 301, 303, 3, 2, 2, 2, 302, 300, 3, 2, 2, 2, 303, 304, 7, 36, 2, 2, 304, 100, 3, 2, 2, 2, 305, 306, 7, 118, 2, 2, 306, 307, 7, 116, 2, 2, 307, 308, 7, 119, 2, 2, 308, 315, 7, 103, 2, 2, 309, 310, 7, 104, 2, 2, 310, 311, 7, 99, 2, 2, 311, 312, 7, 110, 2, 2, 312, 313, 7, 117, 2, 2, 313, 315, 7, 103, 2, 2, 314, 305, 3, 2, 2, 2, 314, 309, 3, 2, 2, 2, 315, 102, 3, 2, 2, 2, 316, 320, 5, 11, 6, 2, 317, 319, 5, 13, 7, 2, 318, 317, 3, 2, 2, 2, 319, 322, 3, 2, 2, 2, 320, 318, 3, 2, 2, 2, 320, 321, 3, 2, 2, 2, 321, 104, 3, 2, 2, 2, 322, 320, 3, 2, 2, 2, 13, 2, 115, 119, 132, 142, 156, 289, 294, 300, 314, 320, 3, 8, 2, 2] \ No newline at end of file diff --git a/src/main/java/lexer/StupsLexer.java b/src/main/java/lexer/StupsLexer.java new file mode 100644 index 0000000..a4d8949 --- /dev/null +++ b/src/main/java/lexer/StupsLexer.java @@ -0,0 +1,246 @@ +// Generated from StupsLexer.g4 by ANTLR 4.8 + +package lexer; + +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.LexerATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; +import org.antlr.v4.runtime.dfa.DFA; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class StupsLexer extends Lexer { + + public static final int + WHITESPACE = 1, MULTILINE_COMMENT = 2, LINE_COMMENT = 3, CLASS = 4, PUBLIC = 5, + STATIC = 6, VOID_TYPE = 7, BOOLEAN_TYPE = 8, STRING_TYPE = 9, IF = 10, ELSE = 11, + WHILE = 12, PRINTLN = 13, ASSIGN = 14, ADD = 15, SUB = 16, MUL = 17, DIV = 18, MOD = 19, + NOT = 20, AND = 21, OR = 22, EQUAL = 23, NOT_EQUAL = 24, LESS = 25, LESS_EQUAL = 26, + GREATER = 27, GREATER_EQUAL = 28, L_PAREN = 29, R_PAREN = 30, L_BRACE = 31, R_BRACE = 32, + L_BRACKET = 33, R_BRACKET = 34, SEMICOLON = 35, COMMA = 36, DOT = 37, INTEGER_LIT = 38, + STRING_LIT = 39, BOOLEAN_LIT = 40, IDENTIFIER = 41; + public static final String[] ruleNames = makeRuleNames(); + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2+\u0143\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\4\30\t\30\4\31\t\31" + + "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!" + + "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4" + + ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t" + + "\64\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\5\6t\n\6\3\7\3\7\5\7x\n\7" + + "\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\6\f\u0083\n\f\r\f\16\f\u0084\3" + + "\f\3\f\3\r\3\r\3\r\3\r\7\r\u008d\n\r\f\r\16\r\u0090\13\r\3\r\3\r\3\r\3" + + "\r\3\r\3\16\3\16\3\16\3\16\7\16\u009b\n\16\f\16\16\16\u009e\13\16\3\16" + + "\3\16\3\17\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\20\3\20" + + "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23\3\23" + + "\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25" + + "\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\30" + + "\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30" + + "\3\30\3\30\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35" + + "\3\36\3\36\3\37\3\37\3 \3 \3 \3!\3!\3!\3\"\3\"\3\"\3#\3#\3#\3$\3$\3%\3" + + "%\3%\3&\3&\3\'\3\'\3\'\3(\3(\3)\3)\3*\3*\3+\3+\3,\3,\3-\3-\3.\3.\3/\3" + + "/\3\60\3\60\3\61\5\61\u0122\n\61\3\61\6\61\u0125\n\61\r\61\16\61\u0126" + + "\3\62\3\62\7\62\u012b\n\62\f\62\16\62\u012e\13\62\3\62\3\62\3\63\3\63" + + "\3\63\3\63\3\63\3\63\3\63\3\63\3\63\5\63\u013b\n\63\3\64\3\64\7\64\u013f" + + "\n\64\f\64\16\64\u0142\13\64\2\2\65\3\2\5\2\7\2\t\2\13\2\r\2\17\2\21\2" + + "\23\2\25\2\27\3\31\4\33\5\35\6\37\7!\b#\t%\n\'\13)\f+\r-\16/\17\61\20" + + "\63\21\65\22\67\239\24;\25=\26?\27A\30C\31E\32G\33I\34K\35M\36O\37Q S" + + "!U\"W#Y$[%]&_\'a(c)e*g+\3\2\t\3\2\63;\3\2\62;\3\2c|\3\2C\\\5\2\13\f\17" + + "\17\"\"\3\2\2\u0081\4\2\f\f\17\17\2\u0142\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\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2" + + "\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2" + + "\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2" + + "K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3" + + "\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2" + + "\2\2e\3\2\2\2\2g\3\2\2\2\3i\3\2\2\2\5k\3\2\2\2\7m\3\2\2\2\to\3\2\2\2\13" + + "s\3\2\2\2\rw\3\2\2\2\17y\3\2\2\2\21{\3\2\2\2\23}\3\2\2\2\25\177\3\2\2" + + "\2\27\u0082\3\2\2\2\31\u0088\3\2\2\2\33\u0096\3\2\2\2\35\u00a1\3\2\2\2" + + "\37\u00a7\3\2\2\2!\u00ae\3\2\2\2#\u00b5\3\2\2\2%\u00ba\3\2\2\2\'\u00c2" + + "\3\2\2\2)\u00c9\3\2\2\2+\u00cc\3\2\2\2-\u00d1\3\2\2\2/\u00d7\3\2\2\2\61" + + "\u00ea\3\2\2\2\63\u00ec\3\2\2\2\65\u00ee\3\2\2\2\67\u00f0\3\2\2\29\u00f2" + + "\3\2\2\2;\u00f4\3\2\2\2=\u00f6\3\2\2\2?\u00f8\3\2\2\2A\u00fb\3\2\2\2C" + + "\u00fe\3\2\2\2E\u0101\3\2\2\2G\u0104\3\2\2\2I\u0106\3\2\2\2K\u0109\3\2" + + "\2\2M\u010b\3\2\2\2O\u010e\3\2\2\2Q\u0110\3\2\2\2S\u0112\3\2\2\2U\u0114" + + "\3\2\2\2W\u0116\3\2\2\2Y\u0118\3\2\2\2[\u011a\3\2\2\2]\u011c\3\2\2\2_" + + "\u011e\3\2\2\2a\u0121\3\2\2\2c\u0128\3\2\2\2e\u013a\3\2\2\2g\u013c\3\2" + + "\2\2ij\t\2\2\2j\4\3\2\2\2kl\t\3\2\2l\6\3\2\2\2mn\t\4\2\2n\b\3\2\2\2op" + + "\t\5\2\2p\n\3\2\2\2qt\5\7\4\2rt\5\t\5\2sq\3\2\2\2sr\3\2\2\2t\f\3\2\2\2" + + "ux\5\13\6\2vx\5\5\3\2wu\3\2\2\2wv\3\2\2\2x\16\3\2\2\2yz\t\6\2\2z\20\3" + + "\2\2\2{|\t\7\2\2|\22\3\2\2\2}~\n\b\2\2~\24\3\2\2\2\177\u0080\n\6\2\2\u0080" + + "\26\3\2\2\2\u0081\u0083\5\17\b\2\u0082\u0081\3\2\2\2\u0083\u0084\3\2\2" + + "\2\u0084\u0082\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u0086\3\2\2\2\u0086\u0087" + + "\b\f\2\2\u0087\30\3\2\2\2\u0088\u0089\7\61\2\2\u0089\u008a\7,\2\2\u008a" + + "\u008e\3\2\2\2\u008b\u008d\5\21\t\2\u008c\u008b\3\2\2\2\u008d\u0090\3" + + "\2\2\2\u008e\u008c\3\2\2\2\u008e\u008f\3\2\2\2\u008f\u0091\3\2\2\2\u0090" + + "\u008e\3\2\2\2\u0091\u0092\7,\2\2\u0092\u0093\7\61\2\2\u0093\u0094\3\2" + + "\2\2\u0094\u0095\b\r\2\2\u0095\32\3\2\2\2\u0096\u0097\7\61\2\2\u0097\u0098" + + "\7\61\2\2\u0098\u009c\3\2\2\2\u0099\u009b\5\23\n\2\u009a\u0099\3\2\2\2" + + "\u009b\u009e\3\2\2\2\u009c\u009a\3\2\2\2\u009c\u009d\3\2\2\2\u009d\u009f" + + "\3\2\2\2\u009e\u009c\3\2\2\2\u009f\u00a0\b\16\2\2\u00a0\34\3\2\2\2\u00a1" + + "\u00a2\7e\2\2\u00a2\u00a3\7n\2\2\u00a3\u00a4\7c\2\2\u00a4\u00a5\7u\2\2" + + "\u00a5\u00a6\7u\2\2\u00a6\36\3\2\2\2\u00a7\u00a8\7r\2\2\u00a8\u00a9\7" + + "w\2\2\u00a9\u00aa\7d\2\2\u00aa\u00ab\7n\2\2\u00ab\u00ac\7k\2\2\u00ac\u00ad" + + "\7e\2\2\u00ad \3\2\2\2\u00ae\u00af\7u\2\2\u00af\u00b0\7v\2\2\u00b0\u00b1" + + "\7c\2\2\u00b1\u00b2\7v\2\2\u00b2\u00b3\7k\2\2\u00b3\u00b4\7e\2\2\u00b4" + + "\"\3\2\2\2\u00b5\u00b6\7x\2\2\u00b6\u00b7\7q\2\2\u00b7\u00b8\7k\2\2\u00b8" + + "\u00b9\7f\2\2\u00b9$\3\2\2\2\u00ba\u00bb\7d\2\2\u00bb\u00bc\7q\2\2\u00bc" + + "\u00bd\7q\2\2\u00bd\u00be\7n\2\2\u00be\u00bf\7g\2\2\u00bf\u00c0\7c\2\2" + + "\u00c0\u00c1\7p\2\2\u00c1&\3\2\2\2\u00c2\u00c3\7U\2\2\u00c3\u00c4\7v\2" + + "\2\u00c4\u00c5\7t\2\2\u00c5\u00c6\7k\2\2\u00c6\u00c7\7p\2\2\u00c7\u00c8" + + "\7i\2\2\u00c8(\3\2\2\2\u00c9\u00ca\7k\2\2\u00ca\u00cb\7h\2\2\u00cb*\3" + + "\2\2\2\u00cc\u00cd\7g\2\2\u00cd\u00ce\7n\2\2\u00ce\u00cf\7u\2\2\u00cf" + + "\u00d0\7g\2\2\u00d0,\3\2\2\2\u00d1\u00d2\7y\2\2\u00d2\u00d3\7j\2\2\u00d3" + + "\u00d4\7k\2\2\u00d4\u00d5\7n\2\2\u00d5\u00d6\7g\2\2\u00d6.\3\2\2\2\u00d7" + + "\u00d8\7U\2\2\u00d8\u00d9\7{\2\2\u00d9\u00da\7u\2\2\u00da\u00db\7v\2\2" + + "\u00db\u00dc\7g\2\2\u00dc\u00dd\7o\2\2\u00dd\u00de\7\60\2\2\u00de\u00df" + + "\7q\2\2\u00df\u00e0\7w\2\2\u00e0\u00e1\7v\2\2\u00e1\u00e2\7\60\2\2\u00e2" + + "\u00e3\7r\2\2\u00e3\u00e4\7t\2\2\u00e4\u00e5\7k\2\2\u00e5\u00e6\7p\2\2" + + "\u00e6\u00e7\7v\2\2\u00e7\u00e8\7n\2\2\u00e8\u00e9\7p\2\2\u00e9\60\3\2" + + "\2\2\u00ea\u00eb\7?\2\2\u00eb\62\3\2\2\2\u00ec\u00ed\7-\2\2\u00ed\64\3" + + "\2\2\2\u00ee\u00ef\7/\2\2\u00ef\66\3\2\2\2\u00f0\u00f1\7,\2\2\u00f18\3" + + "\2\2\2\u00f2\u00f3\7\61\2\2\u00f3:\3\2\2\2\u00f4\u00f5\7\'\2\2\u00f5<" + + "\3\2\2\2\u00f6\u00f7\7#\2\2\u00f7>\3\2\2\2\u00f8\u00f9\7(\2\2\u00f9\u00fa" + + "\7(\2\2\u00fa@\3\2\2\2\u00fb\u00fc\7~\2\2\u00fc\u00fd\7~\2\2\u00fdB\3" + + "\2\2\2\u00fe\u00ff\7?\2\2\u00ff\u0100\7?\2\2\u0100D\3\2\2\2\u0101\u0102" + + "\7#\2\2\u0102\u0103\7?\2\2\u0103F\3\2\2\2\u0104\u0105\7>\2\2\u0105H\3" + + "\2\2\2\u0106\u0107\7>\2\2\u0107\u0108\7?\2\2\u0108J\3\2\2\2\u0109\u010a" + + "\7@\2\2\u010aL\3\2\2\2\u010b\u010c\7@\2\2\u010c\u010d\7?\2\2\u010dN\3" + + "\2\2\2\u010e\u010f\7*\2\2\u010fP\3\2\2\2\u0110\u0111\7+\2\2\u0111R\3\2" + + "\2\2\u0112\u0113\7}\2\2\u0113T\3\2\2\2\u0114\u0115\7\177\2\2\u0115V\3" + + "\2\2\2\u0116\u0117\7]\2\2\u0117X\3\2\2\2\u0118\u0119\7_\2\2\u0119Z\3\2" + + "\2\2\u011a\u011b\7=\2\2\u011b\\\3\2\2\2\u011c\u011d\7.\2\2\u011d^\3\2" + + "\2\2\u011e\u011f\7\60\2\2\u011f`\3\2\2\2\u0120\u0122\7/\2\2\u0121\u0120" + + "\3\2\2\2\u0121\u0122\3\2\2\2\u0122\u0124\3\2\2\2\u0123\u0125\5\5\3\2\u0124" + + "\u0123\3\2\2\2\u0125\u0126\3\2\2\2\u0126\u0124\3\2\2\2\u0126\u0127\3\2" + + "\2\2\u0127b\3\2\2\2\u0128\u012c\7$\2\2\u0129\u012b\5\23\n\2\u012a\u0129" + + "\3\2\2\2\u012b\u012e\3\2\2\2\u012c\u012a\3\2\2\2\u012c\u012d\3\2\2\2\u012d" + + "\u012f\3\2\2\2\u012e\u012c\3\2\2\2\u012f\u0130\7$\2\2\u0130d\3\2\2\2\u0131" + + "\u0132\7v\2\2\u0132\u0133\7t\2\2\u0133\u0134\7w\2\2\u0134\u013b\7g\2\2" + + "\u0135\u0136\7h\2\2\u0136\u0137\7c\2\2\u0137\u0138\7n\2\2\u0138\u0139" + + "\7u\2\2\u0139\u013b\7g\2\2\u013a\u0131\3\2\2\2\u013a\u0135\3\2\2\2\u013b" + + "f\3\2\2\2\u013c\u0140\5\13\6\2\u013d\u013f\5\r\7\2\u013e\u013d\3\2\2\2" + + "\u013f\u0142\3\2\2\2\u0140\u013e\3\2\2\2\u0140\u0141\3\2\2\2\u0141h\3" + + "\2\2\2\u0142\u0140\3\2\2\2\r\2sw\u0084\u008e\u009c\u0121\u0126\u012c\u013a" + + "\u0140\3\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + static { + RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); + } + + 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] = ""; + } + } + } + + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } + + public StupsLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + private static String[] makeRuleNames() { + return new String[]{ + "FIRST_DIGIT", "DIGIT", "LOWERCASE", "UPPERCASE", "LETTER", "LETTER_DIGIT", + "WHITE", "ANY", "ANY_NOBREAK", "ANY_NOWHITE", "WHITESPACE", "MULTILINE_COMMENT", + "LINE_COMMENT", "CLASS", "PUBLIC", "STATIC", "VOID_TYPE", "BOOLEAN_TYPE", + "STRING_TYPE", "IF", "ELSE", "WHILE", "PRINTLN", "ASSIGN", "ADD", "SUB", + "MUL", "DIV", "MOD", "NOT", "AND", "OR", "EQUAL", "NOT_EQUAL", "LESS", + "LESS_EQUAL", "GREATER", "GREATER_EQUAL", "L_PAREN", "R_PAREN", "L_BRACE", + "R_BRACE", "L_BRACKET", "R_BRACKET", "SEMICOLON", "COMMA", "DOT", "INTEGER_LIT", + "STRING_LIT", "BOOLEAN_LIT", "IDENTIFIER" + }; + } + + private static String[] makeLiteralNames() { + return new String[]{ + null, null, null, null, "'class'", "'public'", "'static'", "'void'", + "'boolean'", "'String'", "'if'", "'else'", "'while'", "'System.out.println'", + "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'&&'", "'||'", "'=='", + "'!='", "'<'", "'<='", "'>'", "'>='", "'('", "')'", "'{'", "'}'", "'['", + "']'", "';'", "','", "'.'" + }; + } + + private static String[] makeSymbolicNames() { + return new String[]{ + null, "WHITESPACE", "MULTILINE_COMMENT", "LINE_COMMENT", "CLASS", "PUBLIC", + "STATIC", "VOID_TYPE", "BOOLEAN_TYPE", "STRING_TYPE", "IF", "ELSE", "WHILE", + "PRINTLN", "ASSIGN", "ADD", "SUB", "MUL", "DIV", "MOD", "NOT", "AND", + "OR", "EQUAL", "NOT_EQUAL", "LESS", "LESS_EQUAL", "GREATER", "GREATER_EQUAL", + "L_PAREN", "R_PAREN", "L_BRACE", "R_BRACE", "L_BRACKET", "R_BRACKET", + "SEMICOLON", "COMMA", "DOT", "INTEGER_LIT", "STRING_LIT", "BOOLEAN_LIT", + "IDENTIFIER" + }; + } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String getGrammarFileName() { return "StupsLexer.g4"; } + + @Override + public ATN getATN() { return _ATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } +} diff --git a/src/main/java/lexer/StupsLexer.tokens b/src/main/java/lexer/StupsLexer.tokens new file mode 100644 index 0000000..ddb9983 --- /dev/null +++ b/src/main/java/lexer/StupsLexer.tokens @@ -0,0 +1,75 @@ +WHITESPACE=1 +MULTILINE_COMMENT=2 +LINE_COMMENT=3 +CLASS=4 +PUBLIC=5 +STATIC=6 +VOID_TYPE=7 +BOOLEAN_TYPE=8 +STRING_TYPE=9 +IF=10 +ELSE=11 +WHILE=12 +PRINTLN=13 +ASSIGN=14 +ADD=15 +SUB=16 +MUL=17 +DIV=18 +MOD=19 +NOT=20 +AND=21 +OR=22 +EQUAL=23 +NOT_EQUAL=24 +LESS=25 +LESS_EQUAL=26 +GREATER=27 +GREATER_EQUAL=28 +L_PAREN=29 +R_PAREN=30 +L_BRACE=31 +R_BRACE=32 +L_BRACKET=33 +R_BRACKET=34 +SEMICOLON=35 +COMMA=36 +DOT=37 +INTEGER_LIT=38 +STRING_LIT=39 +BOOLEAN_LIT=40 +IDENTIFIER=41 +'class'=4 +'public'=5 +'static'=6 +'void'=7 +'boolean'=8 +'String'=9 +'if'=10 +'else'=11 +'while'=12 +'System.out.println'=13 +'='=14 +'+'=15 +'-'=16 +'*'=17 +'/'=18 +'%'=19 +'!'=20 +'&&'=21 +'||'=22 +'=='=23 +'!='=24 +'<'=25 +'<='=26 +'>'=27 +'>='=28 +'('=29 +')'=30 +'{'=31 +'}'=32 +'['=33 +']'=34 +';'=35 +','=36 +'.'=37