{
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitProgram(PmmParser.ProgramContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitExpression(PmmParser.ExpressionContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitStatement(PmmParser.StatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitBody(PmmParser.BodyContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitType(PmmParser.TypeContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitFunc_definition(PmmParser.Func_definitionContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitVar_definition(PmmParser.Var_definitionContext ctx) { return visitChildren(ctx); }
+}
\ No newline at end of file
diff --git a/src/parser/PmmLexer.interp b/src/parser/PmmLexer.interp
new file mode 100644
index 0000000..1bbb7ac
--- /dev/null
+++ b/src/parser/PmmLexer.interp
@@ -0,0 +1,153 @@
+token literal names:
+null
+'def'
+'main'
+'('
+')'
+':'
+'{'
+'}'
+'['
+']'
+'.'
+'-'
+'!'
+'*'
+'/'
+'%'
+'+'
+'>='
+'<='
+'=='
+'<'
+'>'
+'!='
+'&&'
+'||'
+','
+'print'
+';'
+'input'
+'='
+'return'
+'if'
+'else'
+'while'
+'int'
+'double'
+'char'
+'struct'
+null
+null
+null
+null
+null
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+MANTISSA
+INT_CONSTANT
+CHAR_CONSTANT
+REAL_CONSTANT
+ID
+ONE_LINE_COMMENT
+MULTI_LINE_COMMENT
+WS
+
+rule names:
+T__0
+T__1
+T__2
+T__3
+T__4
+T__5
+T__6
+T__7
+T__8
+T__9
+T__10
+T__11
+T__12
+T__13
+T__14
+T__15
+T__16
+T__17
+T__18
+T__19
+T__20
+T__21
+T__22
+T__23
+T__24
+T__25
+T__26
+T__27
+T__28
+T__29
+T__30
+T__31
+T__32
+T__33
+T__34
+T__35
+T__36
+DIGIT
+MANTISSA
+INT_CONSTANT
+CHAR_CONSTANT
+REAL_CONSTANT
+ID
+ONE_LINE_COMMENT
+MULTI_LINE_COMMENT
+WS
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 45, 339, 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, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 3, 38, 219, 8, 38, 1, 38, 1, 38, 1, 39, 4, 39, 224, 8, 39, 11, 39, 12, 39, 225, 1, 39, 5, 39, 229, 8, 39, 10, 39, 12, 39, 232, 9, 39, 1, 39, 3, 39, 235, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 5, 40, 244, 8, 40, 10, 40, 12, 40, 247, 9, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 3, 40, 254, 8, 40, 1, 41, 1, 41, 1, 41, 5, 41, 259, 8, 41, 10, 41, 12, 41, 262, 9, 41, 1, 41, 3, 41, 265, 8, 41, 1, 41, 3, 41, 268, 8, 41, 1, 41, 1, 41, 5, 41, 272, 8, 41, 10, 41, 12, 41, 275, 9, 41, 1, 41, 3, 41, 278, 8, 41, 1, 41, 3, 41, 281, 8, 41, 1, 41, 1, 41, 1, 41, 3, 41, 286, 8, 41, 1, 41, 1, 41, 1, 41, 3, 41, 291, 8, 41, 1, 42, 4, 42, 294, 8, 42, 11, 42, 12, 42, 295, 1, 42, 1, 42, 5, 42, 300, 8, 42, 10, 42, 12, 42, 303, 9, 42, 1, 43, 1, 43, 5, 43, 307, 8, 43, 10, 43, 12, 43, 310, 9, 43, 1, 43, 3, 43, 313, 8, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 322, 8, 44, 10, 44, 12, 44, 325, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 4, 45, 334, 8, 45, 11, 45, 12, 45, 335, 1, 45, 1, 45, 3, 245, 308, 323, 0, 46, 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, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 0, 77, 38, 79, 39, 81, 40, 83, 41, 85, 42, 87, 43, 89, 44, 91, 45, 1, 0, 8, 1, 0, 48, 57, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 1, 0, 49, 57, 2, 0, 110, 110, 116, 116, 3, 0, 65, 90, 95, 95, 97, 122, 1, 1, 10, 10, 3, 0, 9, 10, 13, 13, 32, 32, 360, 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, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 1, 93, 1, 0, 0, 0, 3, 97, 1, 0, 0, 0, 5, 102, 1, 0, 0, 0, 7, 104, 1, 0, 0, 0, 9, 106, 1, 0, 0, 0, 11, 108, 1, 0, 0, 0, 13, 110, 1, 0, 0, 0, 15, 112, 1, 0, 0, 0, 17, 114, 1, 0, 0, 0, 19, 116, 1, 0, 0, 0, 21, 118, 1, 0, 0, 0, 23, 120, 1, 0, 0, 0, 25, 122, 1, 0, 0, 0, 27, 124, 1, 0, 0, 0, 29, 126, 1, 0, 0, 0, 31, 128, 1, 0, 0, 0, 33, 130, 1, 0, 0, 0, 35, 133, 1, 0, 0, 0, 37, 136, 1, 0, 0, 0, 39, 139, 1, 0, 0, 0, 41, 141, 1, 0, 0, 0, 43, 143, 1, 0, 0, 0, 45, 146, 1, 0, 0, 0, 47, 149, 1, 0, 0, 0, 49, 152, 1, 0, 0, 0, 51, 154, 1, 0, 0, 0, 53, 160, 1, 0, 0, 0, 55, 162, 1, 0, 0, 0, 57, 168, 1, 0, 0, 0, 59, 170, 1, 0, 0, 0, 61, 177, 1, 0, 0, 0, 63, 180, 1, 0, 0, 0, 65, 185, 1, 0, 0, 0, 67, 191, 1, 0, 0, 0, 69, 195, 1, 0, 0, 0, 71, 202, 1, 0, 0, 0, 73, 207, 1, 0, 0, 0, 75, 214, 1, 0, 0, 0, 77, 216, 1, 0, 0, 0, 79, 234, 1, 0, 0, 0, 81, 253, 1, 0, 0, 0, 83, 290, 1, 0, 0, 0, 85, 293, 1, 0, 0, 0, 87, 304, 1, 0, 0, 0, 89, 316, 1, 0, 0, 0, 91, 333, 1, 0, 0, 0, 93, 94, 5, 100, 0, 0, 94, 95, 5, 101, 0, 0, 95, 96, 5, 102, 0, 0, 96, 2, 1, 0, 0, 0, 97, 98, 5, 109, 0, 0, 98, 99, 5, 97, 0, 0, 99, 100, 5, 105, 0, 0, 100, 101, 5, 110, 0, 0, 101, 4, 1, 0, 0, 0, 102, 103, 5, 40, 0, 0, 103, 6, 1, 0, 0, 0, 104, 105, 5, 41, 0, 0, 105, 8, 1, 0, 0, 0, 106, 107, 5, 58, 0, 0, 107, 10, 1, 0, 0, 0, 108, 109, 5, 123, 0, 0, 109, 12, 1, 0, 0, 0, 110, 111, 5, 125, 0, 0, 111, 14, 1, 0, 0, 0, 112, 113, 5, 91, 0, 0, 113, 16, 1, 0, 0, 0, 114, 115, 5, 93, 0, 0, 115, 18, 1, 0, 0, 0, 116, 117, 5, 46, 0, 0, 117, 20, 1, 0, 0, 0, 118, 119, 5, 45, 0, 0, 119, 22, 1, 0, 0, 0, 120, 121, 5, 33, 0, 0, 121, 24, 1, 0, 0, 0, 122, 123, 5, 42, 0, 0, 123, 26, 1, 0, 0, 0, 124, 125, 5, 47, 0, 0, 125, 28, 1, 0, 0, 0, 126, 127, 5, 37, 0, 0, 127, 30, 1, 0, 0, 0, 128, 129, 5, 43, 0, 0, 129, 32, 1, 0, 0, 0, 130, 131, 5, 62, 0, 0, 131, 132, 5, 61, 0, 0, 132, 34, 1, 0, 0, 0, 133, 134, 5, 60, 0, 0, 134, 135, 5, 61, 0, 0, 135, 36, 1, 0, 0, 0, 136, 137, 5, 61, 0, 0, 137, 138, 5, 61, 0, 0, 138, 38, 1, 0, 0, 0, 139, 140, 5, 60, 0, 0, 140, 40, 1, 0, 0, 0, 141, 142, 5, 62, 0, 0, 142, 42, 1, 0, 0, 0, 143, 144, 5, 33, 0, 0, 144, 145, 5, 61, 0, 0, 145, 44, 1, 0, 0, 0, 146, 147, 5, 38, 0, 0, 147, 148, 5, 38, 0, 0, 148, 46, 1, 0, 0, 0, 149, 150, 5, 124, 0, 0, 150, 151, 5, 124, 0, 0, 151, 48, 1, 0, 0, 0, 152, 153, 5, 44, 0, 0, 153, 50, 1, 0, 0, 0, 154, 155, 5, 112, 0, 0, 155, 156, 5, 114, 0, 0, 156, 157, 5, 105, 0, 0, 157, 158, 5, 110, 0, 0, 158, 159, 5, 116, 0, 0, 159, 52, 1, 0, 0, 0, 160, 161, 5, 59, 0, 0, 161, 54, 1, 0, 0, 0, 162, 163, 5, 105, 0, 0, 163, 164, 5, 110, 0, 0, 164, 165, 5, 112, 0, 0, 165, 166, 5, 117, 0, 0, 166, 167, 5, 116, 0, 0, 167, 56, 1, 0, 0, 0, 168, 169, 5, 61, 0, 0, 169, 58, 1, 0, 0, 0, 170, 171, 5, 114, 0, 0, 171, 172, 5, 101, 0, 0, 172, 173, 5, 116, 0, 0, 173, 174, 5, 117, 0, 0, 174, 175, 5, 114, 0, 0, 175, 176, 5, 110, 0, 0, 176, 60, 1, 0, 0, 0, 177, 178, 5, 105, 0, 0, 178, 179, 5, 102, 0, 0, 179, 62, 1, 0, 0, 0, 180, 181, 5, 101, 0, 0, 181, 182, 5, 108, 0, 0, 182, 183, 5, 115, 0, 0, 183, 184, 5, 101, 0, 0, 184, 64, 1, 0, 0, 0, 185, 186, 5, 119, 0, 0, 186, 187, 5, 104, 0, 0, 187, 188, 5, 105, 0, 0, 188, 189, 5, 108, 0, 0, 189, 190, 5, 101, 0, 0, 190, 66, 1, 0, 0, 0, 191, 192, 5, 105, 0, 0, 192, 193, 5, 110, 0, 0, 193, 194, 5, 116, 0, 0, 194, 68, 1, 0, 0, 0, 195, 196, 5, 100, 0, 0, 196, 197, 5, 111, 0, 0, 197, 198, 5, 117, 0, 0, 198, 199, 5, 98, 0, 0, 199, 200, 5, 108, 0, 0, 200, 201, 5, 101, 0, 0, 201, 70, 1, 0, 0, 0, 202, 203, 5, 99, 0, 0, 203, 204, 5, 104, 0, 0, 204, 205, 5, 97, 0, 0, 205, 206, 5, 114, 0, 0, 206, 72, 1, 0, 0, 0, 207, 208, 5, 115, 0, 0, 208, 209, 5, 116, 0, 0, 209, 210, 5, 114, 0, 0, 210, 211, 5, 117, 0, 0, 211, 212, 5, 99, 0, 0, 212, 213, 5, 116, 0, 0, 213, 74, 1, 0, 0, 0, 214, 215, 7, 0, 0, 0, 215, 76, 1, 0, 0, 0, 216, 218, 7, 1, 0, 0, 217, 219, 7, 2, 0, 0, 218, 217, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 3, 79, 39, 0, 221, 78, 1, 0, 0, 0, 222, 224, 7, 3, 0, 0, 223, 222, 1, 0, 0, 0, 224, 225, 1, 0, 0, 0, 225, 223, 1, 0, 0, 0, 225, 226, 1, 0, 0, 0, 226, 230, 1, 0, 0, 0, 227, 229, 3, 75, 37, 0, 228, 227, 1, 0, 0, 0, 229, 232, 1, 0, 0, 0, 230, 228, 1, 0, 0, 0, 230, 231, 1, 0, 0, 0, 231, 235, 1, 0, 0, 0, 232, 230, 1, 0, 0, 0, 233, 235, 5, 48, 0, 0, 234, 223, 1, 0, 0, 0, 234, 233, 1, 0, 0, 0, 235, 80, 1, 0, 0, 0, 236, 237, 5, 39, 0, 0, 237, 238, 5, 92, 0, 0, 238, 239, 3, 79, 39, 0, 239, 240, 5, 39, 0, 0, 240, 254, 1, 0, 0, 0, 241, 245, 5, 39, 0, 0, 242, 244, 9, 0, 0, 0, 243, 242, 1, 0, 0, 0, 244, 247, 1, 0, 0, 0, 245, 246, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 248, 1, 0, 0, 0, 247, 245, 1, 0, 0, 0, 248, 254, 5, 39, 0, 0, 249, 250, 5, 39, 0, 0, 250, 251, 5, 92, 0, 0, 251, 252, 7, 4, 0, 0, 252, 254, 5, 39, 0, 0, 253, 236, 1, 0, 0, 0, 253, 241, 1, 0, 0, 0, 253, 249, 1, 0, 0, 0, 254, 82, 1, 0, 0, 0, 255, 256, 3, 79, 39, 0, 256, 264, 5, 46, 0, 0, 257, 259, 3, 75, 37, 0, 258, 257, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 265, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 265, 3, 79, 39, 0, 264, 260, 1, 0, 0, 0, 264, 263, 1, 0, 0, 0, 265, 267, 1, 0, 0, 0, 266, 268, 3, 77, 38, 0, 267, 266, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 291, 1, 0, 0, 0, 269, 277, 5, 46, 0, 0, 270, 272, 3, 75, 37, 0, 271, 270, 1, 0, 0, 0, 272, 275, 1, 0, 0, 0, 273, 271, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 278, 1, 0, 0, 0, 275, 273, 1, 0, 0, 0, 276, 278, 3, 79, 39, 0, 277, 273, 1, 0, 0, 0, 277, 276, 1, 0, 0, 0, 278, 280, 1, 0, 0, 0, 279, 281, 3, 77, 38, 0, 280, 279, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 291, 1, 0, 0, 0, 282, 283, 3, 79, 39, 0, 283, 285, 5, 46, 0, 0, 284, 286, 3, 77, 38, 0, 285, 284, 1, 0, 0, 0, 285, 286, 1, 0, 0, 0, 286, 291, 1, 0, 0, 0, 287, 288, 3, 79, 39, 0, 288, 289, 3, 77, 38, 0, 289, 291, 1, 0, 0, 0, 290, 255, 1, 0, 0, 0, 290, 269, 1, 0, 0, 0, 290, 282, 1, 0, 0, 0, 290, 287, 1, 0, 0, 0, 291, 84, 1, 0, 0, 0, 292, 294, 7, 5, 0, 0, 293, 292, 1, 0, 0, 0, 294, 295, 1, 0, 0, 0, 295, 293, 1, 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, 301, 1, 0, 0, 0, 297, 300, 7, 5, 0, 0, 298, 300, 3, 75, 37, 0, 299, 297, 1, 0, 0, 0, 299, 298, 1, 0, 0, 0, 300, 303, 1, 0, 0, 0, 301, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 86, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 304, 308, 5, 35, 0, 0, 305, 307, 9, 0, 0, 0, 306, 305, 1, 0, 0, 0, 307, 310, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 308, 306, 1, 0, 0, 0, 309, 312, 1, 0, 0, 0, 310, 308, 1, 0, 0, 0, 311, 313, 7, 6, 0, 0, 312, 311, 1, 0, 0, 0, 313, 314, 1, 0, 0, 0, 314, 315, 6, 43, 0, 0, 315, 88, 1, 0, 0, 0, 316, 317, 5, 34, 0, 0, 317, 318, 5, 34, 0, 0, 318, 319, 5, 34, 0, 0, 319, 323, 1, 0, 0, 0, 320, 322, 9, 0, 0, 0, 321, 320, 1, 0, 0, 0, 322, 325, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 324, 326, 1, 0, 0, 0, 325, 323, 1, 0, 0, 0, 326, 327, 5, 34, 0, 0, 327, 328, 5, 34, 0, 0, 328, 329, 5, 34, 0, 0, 329, 330, 1, 0, 0, 0, 330, 331, 6, 44, 0, 0, 331, 90, 1, 0, 0, 0, 332, 334, 7, 7, 0, 0, 333, 332, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 333, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 337, 1, 0, 0, 0, 337, 338, 6, 45, 0, 0, 338, 92, 1, 0, 0, 0, 23, 0, 218, 225, 230, 234, 245, 253, 260, 264, 267, 273, 277, 280, 285, 290, 293, 295, 299, 301, 308, 312, 323, 335, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/src/parser/PmmLexer.java b/src/parser/PmmLexer.java
new file mode 100644
index 0000000..d223b96
--- /dev/null
+++ b/src/parser/PmmLexer.java
@@ -0,0 +1,353 @@
+// Generated from java-escape by ANTLR 4.11.1
+package parser;
+
+ import ast.expressions.*;
+ import ast.definitions.*;
+ import ast.statements.*;
+ import ast.types.*;
+ import ast.*;
+
+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", "CheckReturnValue"})
+public class PmmLexer extends Lexer {
+ static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, MANTISSA=38,
+ INT_CONSTANT=39, CHAR_CONSTANT=40, REAL_CONSTANT=41, ID=42, ONE_LINE_COMMENT=43,
+ MULTI_LINE_COMMENT=44, WS=45;
+ public static String[] channelNames = {
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
+ };
+
+ public static String[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ private static String[] makeRuleNames() {
+ return new String[] {
+ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
+ "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
+ "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24",
+ "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
+ "T__33", "T__34", "T__35", "T__36", "DIGIT", "MANTISSA", "INT_CONSTANT",
+ "CHAR_CONSTANT", "REAL_CONSTANT", "ID", "ONE_LINE_COMMENT", "MULTI_LINE_COMMENT",
+ "WS"
+ };
+ }
+ public static final String[] ruleNames = makeRuleNames();
+
+ private static String[] makeLiteralNames() {
+ return new String[] {
+ null, "'def'", "'main'", "'('", "')'", "':'", "'{'", "'}'", "'['", "']'",
+ "'.'", "'-'", "'!'", "'*'", "'/'", "'%'", "'+'", "'>='", "'<='", "'=='",
+ "'<'", "'>'", "'!='", "'&&'", "'||'", "','", "'print'", "';'", "'input'",
+ "'='", "'return'", "'if'", "'else'", "'while'", "'int'", "'double'",
+ "'char'", "'struct'"
+ };
+ }
+ private static final String[] _LITERAL_NAMES = makeLiteralNames();
+ private static String[] makeSymbolicNames() {
+ return new String[] {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "MANTISSA", "INT_CONSTANT", "CHAR_CONSTANT", "REAL_CONSTANT",
+ "ID", "ONE_LINE_COMMENT", "MULTI_LINE_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] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+
+ public PmmLexer(CharStream input) {
+ super(input);
+ _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @Override
+ public String getGrammarFileName() { return "Pmm.g4"; }
+
+ @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 =
+ "\u0004\u0000-\u0153\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"+
+ "\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+
+ "\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+
+ "\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+
+ "\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+
+ "\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
+ "\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
+ "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
+ "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+
+ "&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+
+ "+\u0002,\u0007,\u0002-\u0007-\u0001\u0000\u0001\u0000\u0001\u0000\u0001"+
+ "\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+
+ "\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001"+
+ "\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001"+
+ "\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+
+ "\f\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f"+
+ "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011"+
+ "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0014"+
+ "\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016"+
+ "\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018"+
+ "\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019"+
+ "\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b"+
+ "\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d"+
+ "\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001e"+
+ "\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f"+
+ "\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001"+
+ "!\u0001!\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001"+
+ "#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001"+
+ "$\u0001$\u0001%\u0001%\u0001&\u0001&\u0003&\u00db\b&\u0001&\u0001&\u0001"+
+ "\'\u0004\'\u00e0\b\'\u000b\'\f\'\u00e1\u0001\'\u0005\'\u00e5\b\'\n\'\f"+
+ "\'\u00e8\t\'\u0001\'\u0003\'\u00eb\b\'\u0001(\u0001(\u0001(\u0001(\u0001"+
+ "(\u0001(\u0001(\u0005(\u00f4\b(\n(\f(\u00f7\t(\u0001(\u0001(\u0001(\u0001"+
+ "(\u0001(\u0003(\u00fe\b(\u0001)\u0001)\u0001)\u0005)\u0103\b)\n)\f)\u0106"+
+ "\t)\u0001)\u0003)\u0109\b)\u0001)\u0003)\u010c\b)\u0001)\u0001)\u0005"+
+ ")\u0110\b)\n)\f)\u0113\t)\u0001)\u0003)\u0116\b)\u0001)\u0003)\u0119\b"+
+ ")\u0001)\u0001)\u0001)\u0003)\u011e\b)\u0001)\u0001)\u0001)\u0003)\u0123"+
+ "\b)\u0001*\u0004*\u0126\b*\u000b*\f*\u0127\u0001*\u0001*\u0005*\u012c"+
+ "\b*\n*\f*\u012f\t*\u0001+\u0001+\u0005+\u0133\b+\n+\f+\u0136\t+\u0001"+
+ "+\u0003+\u0139\b+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001,\u0005"+
+ ",\u0142\b,\n,\f,\u0145\t,\u0001,\u0001,\u0001,\u0001,\u0001,\u0001,\u0001"+
+ "-\u0004-\u014e\b-\u000b-\f-\u014f\u0001-\u0001-\u0003\u00f5\u0134\u0143"+
+ "\u0000.\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\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016"+
+ "-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\""+
+ "E#G$I%K\u0000M&O\'Q(S)U*W+Y,[-\u0001\u0000\b\u0001\u000009\u0002\u0000"+
+ "EEee\u0002\u0000++--\u0001\u000019\u0002\u0000nntt\u0003\u0000AZ__az\u0001"+
+ "\u0001\n\n\u0003\u0000\t\n\r\r \u0168\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\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f"+
+ "\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000"+
+ "\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000"+
+ "\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000"+
+ "-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001"+
+ "\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000"+
+ "\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000"+
+ ";\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001"+
+ "\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000"+
+ "\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000"+
+ "I\u0001\u0000\u0000\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001"+
+ "\u0000\u0000\u0000\u0000Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000"+
+ "\u0000\u0000U\u0001\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000"+
+ "Y\u0001\u0000\u0000\u0000\u0000[\u0001\u0000\u0000\u0000\u0001]\u0001"+
+ "\u0000\u0000\u0000\u0003a\u0001\u0000\u0000\u0000\u0005f\u0001\u0000\u0000"+
+ "\u0000\u0007h\u0001\u0000\u0000\u0000\tj\u0001\u0000\u0000\u0000\u000b"+
+ "l\u0001\u0000\u0000\u0000\rn\u0001\u0000\u0000\u0000\u000fp\u0001\u0000"+
+ "\u0000\u0000\u0011r\u0001\u0000\u0000\u0000\u0013t\u0001\u0000\u0000\u0000"+
+ "\u0015v\u0001\u0000\u0000\u0000\u0017x\u0001\u0000\u0000\u0000\u0019z"+
+ "\u0001\u0000\u0000\u0000\u001b|\u0001\u0000\u0000\u0000\u001d~\u0001\u0000"+
+ "\u0000\u0000\u001f\u0080\u0001\u0000\u0000\u0000!\u0082\u0001\u0000\u0000"+
+ "\u0000#\u0085\u0001\u0000\u0000\u0000%\u0088\u0001\u0000\u0000\u0000\'"+
+ "\u008b\u0001\u0000\u0000\u0000)\u008d\u0001\u0000\u0000\u0000+\u008f\u0001"+
+ "\u0000\u0000\u0000-\u0092\u0001\u0000\u0000\u0000/\u0095\u0001\u0000\u0000"+
+ "\u00001\u0098\u0001\u0000\u0000\u00003\u009a\u0001\u0000\u0000\u00005"+
+ "\u00a0\u0001\u0000\u0000\u00007\u00a2\u0001\u0000\u0000\u00009\u00a8\u0001"+
+ "\u0000\u0000\u0000;\u00aa\u0001\u0000\u0000\u0000=\u00b1\u0001\u0000\u0000"+
+ "\u0000?\u00b4\u0001\u0000\u0000\u0000A\u00b9\u0001\u0000\u0000\u0000C"+
+ "\u00bf\u0001\u0000\u0000\u0000E\u00c3\u0001\u0000\u0000\u0000G\u00ca\u0001"+
+ "\u0000\u0000\u0000I\u00cf\u0001\u0000\u0000\u0000K\u00d6\u0001\u0000\u0000"+
+ "\u0000M\u00d8\u0001\u0000\u0000\u0000O\u00ea\u0001\u0000\u0000\u0000Q"+
+ "\u00fd\u0001\u0000\u0000\u0000S\u0122\u0001\u0000\u0000\u0000U\u0125\u0001"+
+ "\u0000\u0000\u0000W\u0130\u0001\u0000\u0000\u0000Y\u013c\u0001\u0000\u0000"+
+ "\u0000[\u014d\u0001\u0000\u0000\u0000]^\u0005d\u0000\u0000^_\u0005e\u0000"+
+ "\u0000_`\u0005f\u0000\u0000`\u0002\u0001\u0000\u0000\u0000ab\u0005m\u0000"+
+ "\u0000bc\u0005a\u0000\u0000cd\u0005i\u0000\u0000de\u0005n\u0000\u0000"+
+ "e\u0004\u0001\u0000\u0000\u0000fg\u0005(\u0000\u0000g\u0006\u0001\u0000"+
+ "\u0000\u0000hi\u0005)\u0000\u0000i\b\u0001\u0000\u0000\u0000jk\u0005:"+
+ "\u0000\u0000k\n\u0001\u0000\u0000\u0000lm\u0005{\u0000\u0000m\f\u0001"+
+ "\u0000\u0000\u0000no\u0005}\u0000\u0000o\u000e\u0001\u0000\u0000\u0000"+
+ "pq\u0005[\u0000\u0000q\u0010\u0001\u0000\u0000\u0000rs\u0005]\u0000\u0000"+
+ "s\u0012\u0001\u0000\u0000\u0000tu\u0005.\u0000\u0000u\u0014\u0001\u0000"+
+ "\u0000\u0000vw\u0005-\u0000\u0000w\u0016\u0001\u0000\u0000\u0000xy\u0005"+
+ "!\u0000\u0000y\u0018\u0001\u0000\u0000\u0000z{\u0005*\u0000\u0000{\u001a"+
+ "\u0001\u0000\u0000\u0000|}\u0005/\u0000\u0000}\u001c\u0001\u0000\u0000"+
+ "\u0000~\u007f\u0005%\u0000\u0000\u007f\u001e\u0001\u0000\u0000\u0000\u0080"+
+ "\u0081\u0005+\u0000\u0000\u0081 \u0001\u0000\u0000\u0000\u0082\u0083\u0005"+
+ ">\u0000\u0000\u0083\u0084\u0005=\u0000\u0000\u0084\"\u0001\u0000\u0000"+
+ "\u0000\u0085\u0086\u0005<\u0000\u0000\u0086\u0087\u0005=\u0000\u0000\u0087"+
+ "$\u0001\u0000\u0000\u0000\u0088\u0089\u0005=\u0000\u0000\u0089\u008a\u0005"+
+ "=\u0000\u0000\u008a&\u0001\u0000\u0000\u0000\u008b\u008c\u0005<\u0000"+
+ "\u0000\u008c(\u0001\u0000\u0000\u0000\u008d\u008e\u0005>\u0000\u0000\u008e"+
+ "*\u0001\u0000\u0000\u0000\u008f\u0090\u0005!\u0000\u0000\u0090\u0091\u0005"+
+ "=\u0000\u0000\u0091,\u0001\u0000\u0000\u0000\u0092\u0093\u0005&\u0000"+
+ "\u0000\u0093\u0094\u0005&\u0000\u0000\u0094.\u0001\u0000\u0000\u0000\u0095"+
+ "\u0096\u0005|\u0000\u0000\u0096\u0097\u0005|\u0000\u0000\u00970\u0001"+
+ "\u0000\u0000\u0000\u0098\u0099\u0005,\u0000\u0000\u00992\u0001\u0000\u0000"+
+ "\u0000\u009a\u009b\u0005p\u0000\u0000\u009b\u009c\u0005r\u0000\u0000\u009c"+
+ "\u009d\u0005i\u0000\u0000\u009d\u009e\u0005n\u0000\u0000\u009e\u009f\u0005"+
+ "t\u0000\u0000\u009f4\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005;\u0000"+
+ "\u0000\u00a16\u0001\u0000\u0000\u0000\u00a2\u00a3\u0005i\u0000\u0000\u00a3"+
+ "\u00a4\u0005n\u0000\u0000\u00a4\u00a5\u0005p\u0000\u0000\u00a5\u00a6\u0005"+
+ "u\u0000\u0000\u00a6\u00a7\u0005t\u0000\u0000\u00a78\u0001\u0000\u0000"+
+ "\u0000\u00a8\u00a9\u0005=\u0000\u0000\u00a9:\u0001\u0000\u0000\u0000\u00aa"+
+ "\u00ab\u0005r\u0000\u0000\u00ab\u00ac\u0005e\u0000\u0000\u00ac\u00ad\u0005"+
+ "t\u0000\u0000\u00ad\u00ae\u0005u\u0000\u0000\u00ae\u00af\u0005r\u0000"+
+ "\u0000\u00af\u00b0\u0005n\u0000\u0000\u00b0<\u0001\u0000\u0000\u0000\u00b1"+
+ "\u00b2\u0005i\u0000\u0000\u00b2\u00b3\u0005f\u0000\u0000\u00b3>\u0001"+
+ "\u0000\u0000\u0000\u00b4\u00b5\u0005e\u0000\u0000\u00b5\u00b6\u0005l\u0000"+
+ "\u0000\u00b6\u00b7\u0005s\u0000\u0000\u00b7\u00b8\u0005e\u0000\u0000\u00b8"+
+ "@\u0001\u0000\u0000\u0000\u00b9\u00ba\u0005w\u0000\u0000\u00ba\u00bb\u0005"+
+ "h\u0000\u0000\u00bb\u00bc\u0005i\u0000\u0000\u00bc\u00bd\u0005l\u0000"+
+ "\u0000\u00bd\u00be\u0005e\u0000\u0000\u00beB\u0001\u0000\u0000\u0000\u00bf"+
+ "\u00c0\u0005i\u0000\u0000\u00c0\u00c1\u0005n\u0000\u0000\u00c1\u00c2\u0005"+
+ "t\u0000\u0000\u00c2D\u0001\u0000\u0000\u0000\u00c3\u00c4\u0005d\u0000"+
+ "\u0000\u00c4\u00c5\u0005o\u0000\u0000\u00c5\u00c6\u0005u\u0000\u0000\u00c6"+
+ "\u00c7\u0005b\u0000\u0000\u00c7\u00c8\u0005l\u0000\u0000\u00c8\u00c9\u0005"+
+ "e\u0000\u0000\u00c9F\u0001\u0000\u0000\u0000\u00ca\u00cb\u0005c\u0000"+
+ "\u0000\u00cb\u00cc\u0005h\u0000\u0000\u00cc\u00cd\u0005a\u0000\u0000\u00cd"+
+ "\u00ce\u0005r\u0000\u0000\u00ceH\u0001\u0000\u0000\u0000\u00cf\u00d0\u0005"+
+ "s\u0000\u0000\u00d0\u00d1\u0005t\u0000\u0000\u00d1\u00d2\u0005r\u0000"+
+ "\u0000\u00d2\u00d3\u0005u\u0000\u0000\u00d3\u00d4\u0005c\u0000\u0000\u00d4"+
+ "\u00d5\u0005t\u0000\u0000\u00d5J\u0001\u0000\u0000\u0000\u00d6\u00d7\u0007"+
+ "\u0000\u0000\u0000\u00d7L\u0001\u0000\u0000\u0000\u00d8\u00da\u0007\u0001"+
+ "\u0000\u0000\u00d9\u00db\u0007\u0002\u0000\u0000\u00da\u00d9\u0001\u0000"+
+ "\u0000\u0000\u00da\u00db\u0001\u0000\u0000\u0000\u00db\u00dc\u0001\u0000"+
+ "\u0000\u0000\u00dc\u00dd\u0003O\'\u0000\u00ddN\u0001\u0000\u0000\u0000"+
+ "\u00de\u00e0\u0007\u0003\u0000\u0000\u00df\u00de\u0001\u0000\u0000\u0000"+
+ "\u00e0\u00e1\u0001\u0000\u0000\u0000\u00e1\u00df\u0001\u0000\u0000\u0000"+
+ "\u00e1\u00e2\u0001\u0000\u0000\u0000\u00e2\u00e6\u0001\u0000\u0000\u0000"+
+ "\u00e3\u00e5\u0003K%\u0000\u00e4\u00e3\u0001\u0000\u0000\u0000\u00e5\u00e8"+
+ "\u0001\u0000\u0000\u0000\u00e6\u00e4\u0001\u0000\u0000\u0000\u00e6\u00e7"+
+ "\u0001\u0000\u0000\u0000\u00e7\u00eb\u0001\u0000\u0000\u0000\u00e8\u00e6"+
+ "\u0001\u0000\u0000\u0000\u00e9\u00eb\u00050\u0000\u0000\u00ea\u00df\u0001"+
+ "\u0000\u0000\u0000\u00ea\u00e9\u0001\u0000\u0000\u0000\u00ebP\u0001\u0000"+
+ "\u0000\u0000\u00ec\u00ed\u0005\'\u0000\u0000\u00ed\u00ee\u0005\\\u0000"+
+ "\u0000\u00ee\u00ef\u0003O\'\u0000\u00ef\u00f0\u0005\'\u0000\u0000\u00f0"+
+ "\u00fe\u0001\u0000\u0000\u0000\u00f1\u00f5\u0005\'\u0000\u0000\u00f2\u00f4"+
+ "\t\u0000\u0000\u0000\u00f3\u00f2\u0001\u0000\u0000\u0000\u00f4\u00f7\u0001"+
+ "\u0000\u0000\u0000\u00f5\u00f6\u0001\u0000\u0000\u0000\u00f5\u00f3\u0001"+
+ "\u0000\u0000\u0000\u00f6\u00f8\u0001\u0000\u0000\u0000\u00f7\u00f5\u0001"+
+ "\u0000\u0000\u0000\u00f8\u00fe\u0005\'\u0000\u0000\u00f9\u00fa\u0005\'"+
+ "\u0000\u0000\u00fa\u00fb\u0005\\\u0000\u0000\u00fb\u00fc\u0007\u0004\u0000"+
+ "\u0000\u00fc\u00fe\u0005\'\u0000\u0000\u00fd\u00ec\u0001\u0000\u0000\u0000"+
+ "\u00fd\u00f1\u0001\u0000\u0000\u0000\u00fd\u00f9\u0001\u0000\u0000\u0000"+
+ "\u00feR\u0001\u0000\u0000\u0000\u00ff\u0100\u0003O\'\u0000\u0100\u0108"+
+ "\u0005.\u0000\u0000\u0101\u0103\u0003K%\u0000\u0102\u0101\u0001\u0000"+
+ "\u0000\u0000\u0103\u0106\u0001\u0000\u0000\u0000\u0104\u0102\u0001\u0000"+
+ "\u0000\u0000\u0104\u0105\u0001\u0000\u0000\u0000\u0105\u0109\u0001\u0000"+
+ "\u0000\u0000\u0106\u0104\u0001\u0000\u0000\u0000\u0107\u0109\u0003O\'"+
+ "\u0000\u0108\u0104\u0001\u0000\u0000\u0000\u0108\u0107\u0001\u0000\u0000"+
+ "\u0000\u0109\u010b\u0001\u0000\u0000\u0000\u010a\u010c\u0003M&\u0000\u010b"+
+ "\u010a\u0001\u0000\u0000\u0000\u010b\u010c\u0001\u0000\u0000\u0000\u010c"+
+ "\u0123\u0001\u0000\u0000\u0000\u010d\u0115\u0005.\u0000\u0000\u010e\u0110"+
+ "\u0003K%\u0000\u010f\u010e\u0001\u0000\u0000\u0000\u0110\u0113\u0001\u0000"+
+ "\u0000\u0000\u0111\u010f\u0001\u0000\u0000\u0000\u0111\u0112\u0001\u0000"+
+ "\u0000\u0000\u0112\u0116\u0001\u0000\u0000\u0000\u0113\u0111\u0001\u0000"+
+ "\u0000\u0000\u0114\u0116\u0003O\'\u0000\u0115\u0111\u0001\u0000\u0000"+
+ "\u0000\u0115\u0114\u0001\u0000\u0000\u0000\u0116\u0118\u0001\u0000\u0000"+
+ "\u0000\u0117\u0119\u0003M&\u0000\u0118\u0117\u0001\u0000\u0000\u0000\u0118"+
+ "\u0119\u0001\u0000\u0000\u0000\u0119\u0123\u0001\u0000\u0000\u0000\u011a"+
+ "\u011b\u0003O\'\u0000\u011b\u011d\u0005.\u0000\u0000\u011c\u011e\u0003"+
+ "M&\u0000\u011d\u011c\u0001\u0000\u0000\u0000\u011d\u011e\u0001\u0000\u0000"+
+ "\u0000\u011e\u0123\u0001\u0000\u0000\u0000\u011f\u0120\u0003O\'\u0000"+
+ "\u0120\u0121\u0003M&\u0000\u0121\u0123\u0001\u0000\u0000\u0000\u0122\u00ff"+
+ "\u0001\u0000\u0000\u0000\u0122\u010d\u0001\u0000\u0000\u0000\u0122\u011a"+
+ "\u0001\u0000\u0000\u0000\u0122\u011f\u0001\u0000\u0000\u0000\u0123T\u0001"+
+ "\u0000\u0000\u0000\u0124\u0126\u0007\u0005\u0000\u0000\u0125\u0124\u0001"+
+ "\u0000\u0000\u0000\u0126\u0127\u0001\u0000\u0000\u0000\u0127\u0125\u0001"+
+ "\u0000\u0000\u0000\u0127\u0128\u0001\u0000\u0000\u0000\u0128\u012d\u0001"+
+ "\u0000\u0000\u0000\u0129\u012c\u0007\u0005\u0000\u0000\u012a\u012c\u0003"+
+ "K%\u0000\u012b\u0129\u0001\u0000\u0000\u0000\u012b\u012a\u0001\u0000\u0000"+
+ "\u0000\u012c\u012f\u0001\u0000\u0000\u0000\u012d\u012b\u0001\u0000\u0000"+
+ "\u0000\u012d\u012e\u0001\u0000\u0000\u0000\u012eV\u0001\u0000\u0000\u0000"+
+ "\u012f\u012d\u0001\u0000\u0000\u0000\u0130\u0134\u0005#\u0000\u0000\u0131"+
+ "\u0133\t\u0000\u0000\u0000\u0132\u0131\u0001\u0000\u0000\u0000\u0133\u0136"+
+ "\u0001\u0000\u0000\u0000\u0134\u0135\u0001\u0000\u0000\u0000\u0134\u0132"+
+ "\u0001\u0000\u0000\u0000\u0135\u0138\u0001\u0000\u0000\u0000\u0136\u0134"+
+ "\u0001\u0000\u0000\u0000\u0137\u0139\u0007\u0006\u0000\u0000\u0138\u0137"+
+ "\u0001\u0000\u0000\u0000\u0139\u013a\u0001\u0000\u0000\u0000\u013a\u013b"+
+ "\u0006+\u0000\u0000\u013bX\u0001\u0000\u0000\u0000\u013c\u013d\u0005\""+
+ "\u0000\u0000\u013d\u013e\u0005\"\u0000\u0000\u013e\u013f\u0005\"\u0000"+
+ "\u0000\u013f\u0143\u0001\u0000\u0000\u0000\u0140\u0142\t\u0000\u0000\u0000"+
+ "\u0141\u0140\u0001\u0000\u0000\u0000\u0142\u0145\u0001\u0000\u0000\u0000"+
+ "\u0143\u0144\u0001\u0000\u0000\u0000\u0143\u0141\u0001\u0000\u0000\u0000"+
+ "\u0144\u0146\u0001\u0000\u0000\u0000\u0145\u0143\u0001\u0000\u0000\u0000"+
+ "\u0146\u0147\u0005\"\u0000\u0000\u0147\u0148\u0005\"\u0000\u0000\u0148"+
+ "\u0149\u0005\"\u0000\u0000\u0149\u014a\u0001\u0000\u0000\u0000\u014a\u014b"+
+ "\u0006,\u0000\u0000\u014bZ\u0001\u0000\u0000\u0000\u014c\u014e\u0007\u0007"+
+ "\u0000\u0000\u014d\u014c\u0001\u0000\u0000\u0000\u014e\u014f\u0001\u0000"+
+ "\u0000\u0000\u014f\u014d\u0001\u0000\u0000\u0000\u014f\u0150\u0001\u0000"+
+ "\u0000\u0000\u0150\u0151\u0001\u0000\u0000\u0000\u0151\u0152\u0006-\u0000"+
+ "\u0000\u0152\\\u0001\u0000\u0000\u0000\u0017\u0000\u00da\u00e1\u00e6\u00ea"+
+ "\u00f5\u00fd\u0104\u0108\u010b\u0111\u0115\u0118\u011d\u0122\u0125\u0127"+
+ "\u012b\u012d\u0134\u0138\u0143\u014f\u0001\u0006\u0000\u0000";
+ 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/src/parser/PmmLexer.tokens b/src/parser/PmmLexer.tokens
new file mode 100644
index 0000000..208efc1
--- /dev/null
+++ b/src/parser/PmmLexer.tokens
@@ -0,0 +1,82 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+T__25=26
+T__26=27
+T__27=28
+T__28=29
+T__29=30
+T__30=31
+T__31=32
+T__32=33
+T__33=34
+T__34=35
+T__35=36
+T__36=37
+MANTISSA=38
+INT_CONSTANT=39
+CHAR_CONSTANT=40
+REAL_CONSTANT=41
+ID=42
+ONE_LINE_COMMENT=43
+MULTI_LINE_COMMENT=44
+WS=45
+'def'=1
+'main'=2
+'('=3
+')'=4
+':'=5
+'{'=6
+'}'=7
+'['=8
+']'=9
+'.'=10
+'-'=11
+'!'=12
+'*'=13
+'/'=14
+'%'=15
+'+'=16
+'>='=17
+'<='=18
+'=='=19
+'<'=20
+'>'=21
+'!='=22
+'&&'=23
+'||'=24
+','=25
+'print'=26
+';'=27
+'input'=28
+'='=29
+'return'=30
+'if'=31
+'else'=32
+'while'=33
+'int'=34
+'double'=35
+'char'=36
+'struct'=37
diff --git a/src/parser/PmmParser.java b/src/parser/PmmParser.java
new file mode 100644
index 0000000..5872c8f
--- /dev/null
+++ b/src/parser/PmmParser.java
@@ -0,0 +1,1600 @@
+// Generated from java-escape by ANTLR 4.11.1
+package parser;
+
+ import ast.expressions.*;
+ import ast.definitions.*;
+ import ast.statements.*;
+ import ast.types.*;
+ import ast.*;
+
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
+import org.antlr.v4.runtime.tree.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
+public class PmmParser extends Parser {
+ static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, MANTISSA=38,
+ INT_CONSTANT=39, CHAR_CONSTANT=40, REAL_CONSTANT=41, ID=42, ONE_LINE_COMMENT=43,
+ MULTI_LINE_COMMENT=44, WS=45;
+ public static final int
+ RULE_program = 0, RULE_expression = 1, RULE_statement = 2, RULE_body = 3,
+ RULE_type = 4, RULE_func_definition = 5, RULE_var_definition = 6;
+ private static String[] makeRuleNames() {
+ return new String[] {
+ "program", "expression", "statement", "body", "type", "func_definition",
+ "var_definition"
+ };
+ }
+ public static final String[] ruleNames = makeRuleNames();
+
+ private static String[] makeLiteralNames() {
+ return new String[] {
+ null, "'def'", "'main'", "'('", "')'", "':'", "'{'", "'}'", "'['", "']'",
+ "'.'", "'-'", "'!'", "'*'", "'/'", "'%'", "'+'", "'>='", "'<='", "'=='",
+ "'<'", "'>'", "'!='", "'&&'", "'||'", "','", "'print'", "';'", "'input'",
+ "'='", "'return'", "'if'", "'else'", "'while'", "'int'", "'double'",
+ "'char'", "'struct'"
+ };
+ }
+ private static final String[] _LITERAL_NAMES = makeLiteralNames();
+ private static String[] makeSymbolicNames() {
+ return new String[] {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "MANTISSA", "INT_CONSTANT", "CHAR_CONSTANT", "REAL_CONSTANT",
+ "ID", "ONE_LINE_COMMENT", "MULTI_LINE_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] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+ @Override
+ public String getGrammarFileName() { return "java-escape"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public PmmParser(TokenStream input) {
+ super(input);
+ _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ProgramContext extends ParserRuleContext {
+ public Program ast;
+ public FuncDefinition main;
+ public Var_definitionContext v;
+ public Func_definitionContext f;
+ public Token MAIN;
+ public Var_definitionContext v2;
+ public StatementContext st;
+ public TerminalNode EOF() { return getToken(PmmParser.EOF, 0); }
+ public List var_definition() {
+ return getRuleContexts(Var_definitionContext.class);
+ }
+ public Var_definitionContext var_definition(int i) {
+ return getRuleContext(Var_definitionContext.class,i);
+ }
+ public List func_definition() {
+ return getRuleContexts(Func_definitionContext.class);
+ }
+ public Func_definitionContext func_definition(int i) {
+ return getRuleContext(Func_definitionContext.class,i);
+ }
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public ProgramContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_program; }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof PmmVisitor ) return ((PmmVisitor extends T>)visitor).visitProgram(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ProgramContext program() throws RecognitionException {
+ ProgramContext _localctx = new ProgramContext(_ctx, getState());
+ enterRule(_localctx, 0, RULE_program);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ ((ProgramContext)_localctx).ast = new Program(0,0);
+ setState(23);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,1,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ {
+ setState(21);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case ID:
+ {
+ setState(15);
+ ((ProgramContext)_localctx).v = var_definition();
+ for (VarDefinition vd : ((ProgramContext)_localctx).v.ast) _localctx.ast.addDefinition(vd);
+ }
+ break;
+ case T__0:
+ {
+ setState(18);
+ ((ProgramContext)_localctx).f = func_definition();
+ _localctx.ast.addDefinition(((ProgramContext)_localctx).f.ast);
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ }
+ setState(25);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,1,_ctx);
+ }
+ setState(26);
+ match(T__0);
+ setState(27);
+ ((ProgramContext)_localctx).MAIN = match(T__1);
+ setState(28);
+ match(T__2);
+ setState(29);
+ match(T__3);
+ setState(30);
+ match(T__4);
+ ((ProgramContext)_localctx).main = new FuncDefinition(((ProgramContext)_localctx).MAIN.getLine(), ((ProgramContext)_localctx).MAIN.getCharPositionInLine()+1,
+ new FunctionType(((ProgramContext)_localctx).MAIN.getLine(), ((ProgramContext)_localctx).MAIN.getCharPositionInLine()+1, new ArrayList<>(),
+ VoidType.getInstance())
+ , (((ProgramContext)_localctx).MAIN!=null?((ProgramContext)_localctx).MAIN.getText():null));
+ setState(32);
+ match(T__5);
+ setState(38);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,2,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ {
+ {
+ setState(33);
+ ((ProgramContext)_localctx).v2 = var_definition();
+ for (VarDefinition vd : ((ProgramContext)_localctx).v2.ast) _localctx.main.addDefinition(vd);
+ }
+ }
+ }
+ setState(40);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,2,_ctx);
+ }
+ setState(46);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (((_la) & ~0x3f) == 0 && ((1L << _la) & 8258483918856L) != 0) {
+ {
+ {
+ setState(41);
+ ((ProgramContext)_localctx).st = statement();
+ _localctx.main.addStatement(((ProgramContext)_localctx).st.ast);
+ }
+ }
+ setState(48);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(49);
+ match(T__6);
+ _localctx.ast.addDefinition(_localctx.main);
+ setState(51);
+ match(EOF);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ExpressionContext extends ParserRuleContext {
+ public Expression ast;
+ public ExpressionContext left;
+ public ExpressionContext exp;
+ public TypeContext type;
+ public Token ID;
+ public ExpressionContext exp1;
+ public ExpressionContext exp2;
+ public Token INT_CONSTANT;
+ public Token CHAR_CONSTANT;
+ public Token REAL_CONSTANT;
+ public Token OP;
+ public ExpressionContext right;
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public TypeContext type() {
+ return getRuleContext(TypeContext.class,0);
+ }
+ public TerminalNode ID() { return getToken(PmmParser.ID, 0); }
+ public TerminalNode INT_CONSTANT() { return getToken(PmmParser.INT_CONSTANT, 0); }
+ public TerminalNode CHAR_CONSTANT() { return getToken(PmmParser.CHAR_CONSTANT, 0); }
+ public TerminalNode REAL_CONSTANT() { return getToken(PmmParser.REAL_CONSTANT, 0); }
+ public ExpressionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_expression; }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof PmmVisitor ) return ((PmmVisitor extends T>)visitor).visitExpression(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ExpressionContext expression() throws RecognitionException {
+ return expression(0);
+ }
+
+ private ExpressionContext expression(int _p) throws RecognitionException {
+ ParserRuleContext _parentctx = _ctx;
+ int _parentState = getState();
+ ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState);
+ ExpressionContext _prevctx = _localctx;
+ int _startState = 2;
+ enterRecursionRule(_localctx, 2, RULE_expression, _p);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(99);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) {
+ case 1:
+ {
+ setState(54);
+ match(T__2);
+ setState(55);
+ ((ExpressionContext)_localctx).exp = expression(0);
+ setState(56);
+ match(T__3);
+ ((ExpressionContext)_localctx).ast = ((ExpressionContext)_localctx).exp.ast;
+ }
+ break;
+ case 2:
+ {
+ setState(59);
+ match(T__2);
+ setState(60);
+ ((ExpressionContext)_localctx).type = type();
+ setState(61);
+ match(T__3);
+ setState(62);
+ ((ExpressionContext)_localctx).exp = expression(12);
+ ((ExpressionContext)_localctx).ast = new Cast(((ExpressionContext)_localctx).exp.ast.getLine(), ((ExpressionContext)_localctx).exp.ast.getColumn(), ((ExpressionContext)_localctx).type.ast, ((ExpressionContext)_localctx).exp.ast);
+ }
+ break;
+ case 3:
+ {
+ setState(65);
+ match(T__10);
+ setState(66);
+ ((ExpressionContext)_localctx).exp = expression(11);
+ ((ExpressionContext)_localctx).ast = new Minus(((ExpressionContext)_localctx).exp.ast.getLine(), ((ExpressionContext)_localctx).exp.ast.getColumn(), ((ExpressionContext)_localctx).exp.ast);
+ }
+ break;
+ case 4:
+ {
+ setState(69);
+ match(T__11);
+ setState(70);
+ ((ExpressionContext)_localctx).exp = expression(10);
+ ((ExpressionContext)_localctx).ast = new Negation(((ExpressionContext)_localctx).exp.ast.getLine(), ((ExpressionContext)_localctx).exp.ast.getColumn(), ((ExpressionContext)_localctx).exp.ast);
+ }
+ break;
+ case 5:
+ {
+ setState(73);
+ ((ExpressionContext)_localctx).ID = match(ID);
+ FuncInvocation funcInv = new FuncInvocation(((ExpressionContext)_localctx).ID.getLine(), ((ExpressionContext)_localctx).ID.getCharPositionInLine()+1, new Variable(((ExpressionContext)_localctx).ID.getLine(), ((ExpressionContext)_localctx).ID.getCharPositionInLine()+1, ((ExpressionContext)_localctx).ID.getText()));
+ setState(75);
+ match(T__2);
+ setState(87);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ if (((_la) & ~0x3f) == 0 && ((1L << _la) & 8246337214472L) != 0) {
+ {
+ setState(76);
+ ((ExpressionContext)_localctx).exp1 = expression(0);
+ funcInv.addExpression(((ExpressionContext)_localctx).exp1.ast);
+ setState(84);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__24) {
+ {
+ {
+ setState(78);
+ match(T__24);
+ setState(79);
+ ((ExpressionContext)_localctx).exp2 = expression(0);
+ funcInv.addExpression(((ExpressionContext)_localctx).exp2.ast);
+ }
+ }
+ setState(86);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+
+ setState(89);
+ match(T__3);
+ ((ExpressionContext)_localctx).ast = funcInv;
+ }
+ break;
+ case 6:
+ {
+ setState(91);
+ ((ExpressionContext)_localctx).INT_CONSTANT = match(INT_CONSTANT);
+ ((ExpressionContext)_localctx).ast = new IntLiteral(((ExpressionContext)_localctx).INT_CONSTANT.getLine(), ((ExpressionContext)_localctx).INT_CONSTANT.getCharPositionInLine()+1,LexerHelper.lexemeToInt(((ExpressionContext)_localctx).INT_CONSTANT.getText()));
+ }
+ break;
+ case 7:
+ {
+ setState(93);
+ ((ExpressionContext)_localctx).CHAR_CONSTANT = match(CHAR_CONSTANT);
+ ((ExpressionContext)_localctx).ast = new CharLiteral(((ExpressionContext)_localctx).CHAR_CONSTANT.getLine(), ((ExpressionContext)_localctx).CHAR_CONSTANT.getCharPositionInLine()+1,LexerHelper.lexemeToChar(((ExpressionContext)_localctx).CHAR_CONSTANT.getText()));
+ }
+ break;
+ case 8:
+ {
+ setState(95);
+ ((ExpressionContext)_localctx).REAL_CONSTANT = match(REAL_CONSTANT);
+ ((ExpressionContext)_localctx).ast = new DoubleLiteral(((ExpressionContext)_localctx).REAL_CONSTANT.getLine(), ((ExpressionContext)_localctx).REAL_CONSTANT.getCharPositionInLine()+1,LexerHelper.lexemeToReal(((ExpressionContext)_localctx).REAL_CONSTANT.getText()));
+ }
+ break;
+ case 9:
+ {
+ setState(97);
+ ((ExpressionContext)_localctx).ID = match(ID);
+ ((ExpressionContext)_localctx).ast = new Variable(((ExpressionContext)_localctx).ID.getLine(), ((ExpressionContext)_localctx).ID.getCharPositionInLine()+1, ((ExpressionContext)_localctx).ID.getText());
+ }
+ break;
+ }
+ _ctx.stop = _input.LT(-1);
+ setState(133);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,8,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ if ( _parseListeners!=null ) triggerExitRuleEvent();
+ _prevctx = _localctx;
+ {
+ setState(131);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
+ case 1:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.left = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(101);
+ if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
+ setState(102);
+ ((ExpressionContext)_localctx).OP = _input.LT(1);
+ _la = _input.LA(1);
+ if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 57344L) != 0) ) {
+ ((ExpressionContext)_localctx).OP = (Token)_errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(103);
+ ((ExpressionContext)_localctx).right = expression(10);
+ ((ExpressionContext)_localctx).ast = new Arithmetic(((ExpressionContext)_localctx).left.ast.getLine(), ((ExpressionContext)_localctx).left.ast.getColumn(), ((ExpressionContext)_localctx).left.ast, ((ExpressionContext)_localctx).right.ast, (((ExpressionContext)_localctx).OP!=null?((ExpressionContext)_localctx).OP.getText():null));
+ }
+ break;
+ case 2:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.left = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(106);
+ if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
+ setState(107);
+ ((ExpressionContext)_localctx).OP = _input.LT(1);
+ _la = _input.LA(1);
+ if ( !(_la==T__10 || _la==T__15) ) {
+ ((ExpressionContext)_localctx).OP = (Token)_errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(108);
+ ((ExpressionContext)_localctx).right = expression(9);
+ ((ExpressionContext)_localctx).ast = new Arithmetic(((ExpressionContext)_localctx).left.ast.getLine(), ((ExpressionContext)_localctx).left.ast.getColumn(), ((ExpressionContext)_localctx).left.ast, ((ExpressionContext)_localctx).right.ast, (((ExpressionContext)_localctx).OP!=null?((ExpressionContext)_localctx).OP.getText():null));
+ }
+ break;
+ case 3:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.left = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(111);
+ if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
+ setState(112);
+ ((ExpressionContext)_localctx).OP = _input.LT(1);
+ _la = _input.LA(1);
+ if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 8257536L) != 0) ) {
+ ((ExpressionContext)_localctx).OP = (Token)_errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(113);
+ ((ExpressionContext)_localctx).right = expression(8);
+ ((ExpressionContext)_localctx).ast = new ArithComparison(((ExpressionContext)_localctx).left.ast.getLine(), ((ExpressionContext)_localctx).left.ast.getColumn(), ((ExpressionContext)_localctx).left.ast, ((ExpressionContext)_localctx).right.ast, (((ExpressionContext)_localctx).OP!=null?((ExpressionContext)_localctx).OP.getText():null));
+ }
+ break;
+ case 4:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.left = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(116);
+ if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
+ setState(117);
+ ((ExpressionContext)_localctx).OP = _input.LT(1);
+ _la = _input.LA(1);
+ if ( !(_la==T__22 || _la==T__23) ) {
+ ((ExpressionContext)_localctx).OP = (Token)_errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(118);
+ ((ExpressionContext)_localctx).right = expression(7);
+ ((ExpressionContext)_localctx).ast = new LogComparison(((ExpressionContext)_localctx).left.ast.getLine(), ((ExpressionContext)_localctx).left.ast.getColumn(), ((ExpressionContext)_localctx).left.ast, ((ExpressionContext)_localctx).right.ast, (((ExpressionContext)_localctx).OP!=null?((ExpressionContext)_localctx).OP.getText():null));
+ }
+ break;
+ case 5:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.left = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(121);
+ if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)");
+ setState(122);
+ match(T__7);
+ setState(123);
+ ((ExpressionContext)_localctx).right = expression(0);
+ setState(124);
+ match(T__8);
+ ((ExpressionContext)_localctx).ast = new ArrayIndexer(((ExpressionContext)_localctx).left.ast.getLine(), ((ExpressionContext)_localctx).left.ast.getColumn(), ((ExpressionContext)_localctx).left.ast, ((ExpressionContext)_localctx).right.ast);
+ }
+ break;
+ case 6:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ _localctx.exp = _prevctx;
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(127);
+ if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)");
+ setState(128);
+ match(T__9);
+ setState(129);
+ ((ExpressionContext)_localctx).ID = match(ID);
+ ((ExpressionContext)_localctx).ast = new FieldAccess(((ExpressionContext)_localctx).exp.ast.getLine(), ((ExpressionContext)_localctx).exp.ast.getColumn(), ((ExpressionContext)_localctx).exp.ast, ((ExpressionContext)_localctx).ID.getText());
+ }
+ break;
+ }
+ }
+ }
+ setState(135);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,8,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ unrollRecursionContexts(_parentctx);
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class StatementContext extends ParserRuleContext {
+ public Statement ast;
+ public Token PRINT;
+ public ExpressionContext exp1;
+ public ExpressionContext exp2;
+ public Token INPUT;
+ public BodyContext b1;
+ public BodyContext b2;
+ public ExpressionContext exp;
+ public BodyContext b;
+ public Token ID;
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public List body() {
+ return getRuleContexts(BodyContext.class);
+ }
+ public BodyContext body(int i) {
+ return getRuleContext(BodyContext.class,i);
+ }
+ public TerminalNode ID() { return getToken(PmmParser.ID, 0); }
+ public StatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_statement; }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof PmmVisitor ) return ((PmmVisitor extends T>)visitor).visitStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final StatementContext statement() throws RecognitionException {
+ StatementContext _localctx = new StatementContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_statement);
+ int _la;
+ try {
+ setState(218);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) {
+ case 1:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(136);
+ ((StatementContext)_localctx).PRINT = match(T__25);
+ Print print = new Print(((StatementContext)_localctx).PRINT.getLine(), ((StatementContext)_localctx).PRINT.getCharPositionInLine()+1);
+ setState(138);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ print.addExpression(((StatementContext)_localctx).exp1.ast);
+ setState(146);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__24) {
+ {
+ {
+ setState(140);
+ match(T__24);
+ setState(141);
+ ((StatementContext)_localctx).exp2 = expression(0);
+ print.addExpression(((StatementContext)_localctx).exp2.ast);
+ }
+ }
+ setState(148);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(149);
+ match(T__26);
+ ((StatementContext)_localctx).ast = print;
+ }
+ break;
+ case 2:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(152);
+ ((StatementContext)_localctx).INPUT = match(T__27);
+ Input input = new Input(((StatementContext)_localctx).INPUT.getLine(), ((StatementContext)_localctx).INPUT.getCharPositionInLine()+1);
+ setState(154);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ input.addExpression(((StatementContext)_localctx).exp1.ast);
+ setState(162);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__24) {
+ {
+ {
+ setState(156);
+ match(T__24);
+ setState(157);
+ ((StatementContext)_localctx).exp2 = expression(0);
+ input.addExpression(((StatementContext)_localctx).exp2.ast);
+ }
+ }
+ setState(164);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(165);
+ match(T__26);
+ ((StatementContext)_localctx).ast = input;
+ }
+ break;
+ case 3:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(168);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ setState(169);
+ match(T__28);
+ setState(170);
+ ((StatementContext)_localctx).exp2 = expression(0);
+ setState(171);
+ match(T__26);
+ ((StatementContext)_localctx).ast = new Assignment(((StatementContext)_localctx).exp1.ast.getLine(), ((StatementContext)_localctx).exp1.ast.getColumn(), ((StatementContext)_localctx).exp1.ast, ((StatementContext)_localctx).exp2.ast);
+ }
+ break;
+ case 4:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(174);
+ match(T__29);
+ setState(175);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ setState(176);
+ match(T__26);
+ ((StatementContext)_localctx).ast = new Return(((StatementContext)_localctx).exp1.ast.getLine(), ((StatementContext)_localctx).exp1.ast.getColumn(), ((StatementContext)_localctx).exp1.ast);
+ }
+ break;
+ case 5:
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(179);
+ match(T__30);
+ setState(180);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ setState(181);
+ match(T__4);
+ setState(182);
+ ((StatementContext)_localctx).b1 = body();
+ IfStatement ifs = new IfStatement(((StatementContext)_localctx).exp1.ast.getLine(), ((StatementContext)_localctx).exp1.ast.getColumn(), ((StatementContext)_localctx).exp1.ast, ((StatementContext)_localctx).b1.ast);
+ setState(189);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,11,_ctx) ) {
+ case 1:
+ {
+ setState(184);
+ match(T__31);
+ setState(185);
+ match(T__4);
+ setState(186);
+ ((StatementContext)_localctx).b2 = body();
+ ifs.setElse(((StatementContext)_localctx).b2.ast);
+ }
+ break;
+ }
+ ((StatementContext)_localctx).ast = ifs;
+ }
+ break;
+ case 6:
+ enterOuterAlt(_localctx, 6);
+ {
+ setState(193);
+ match(T__32);
+ setState(194);
+ ((StatementContext)_localctx).exp = expression(0);
+ setState(195);
+ match(T__4);
+ setState(196);
+ ((StatementContext)_localctx).b = body();
+ ((StatementContext)_localctx).ast = new While(((StatementContext)_localctx).exp.ast.getLine(), ((StatementContext)_localctx).exp.ast.getColumn(), ((StatementContext)_localctx).exp.ast, ((StatementContext)_localctx).b.ast);
+ }
+ break;
+ case 7:
+ enterOuterAlt(_localctx, 7);
+ {
+ setState(199);
+ ((StatementContext)_localctx).ID = match(ID);
+ FuncInvocation funcInv = new FuncInvocation(((StatementContext)_localctx).ID.getLine(), ((StatementContext)_localctx).ID.getCharPositionInLine()+1, new Variable(((StatementContext)_localctx).ID.getLine(), ((StatementContext)_localctx).ID.getCharPositionInLine()+1, ((StatementContext)_localctx).ID.getText()));
+ setState(201);
+ match(T__2);
+ setState(213);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ if (((_la) & ~0x3f) == 0 && ((1L << _la) & 8246337214472L) != 0) {
+ {
+ setState(202);
+ ((StatementContext)_localctx).exp1 = expression(0);
+ funcInv.addExpression(((StatementContext)_localctx).exp1.ast);
+ setState(210);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__24) {
+ {
+ {
+ setState(204);
+ match(T__24);
+ setState(205);
+ ((StatementContext)_localctx).exp2 = expression(0);
+ funcInv.addExpression(((StatementContext)_localctx).exp2.ast);
+ }
+ }
+ setState(212);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+
+ setState(215);
+ match(T__3);
+ setState(216);
+ match(T__26);
+ ((StatementContext)_localctx).ast = funcInv;
+ }
+ break;
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class BodyContext extends ParserRuleContext {
+ public List ast = new ArrayList();
+ public StatementContext st1;
+ public StatementContext st2;
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public BodyContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_body; }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof PmmVisitor ) return ((PmmVisitor extends T>)visitor).visitBody(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final BodyContext body() throws RecognitionException {
+ BodyContext _localctx = new BodyContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_body);
+ int _la;
+ try {
+ setState(233);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__2:
+ case T__10:
+ case T__11:
+ case T__25:
+ case T__27:
+ case T__29:
+ case T__30:
+ case T__32:
+ case INT_CONSTANT:
+ case CHAR_CONSTANT:
+ case REAL_CONSTANT:
+ case ID:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(220);
+ ((BodyContext)_localctx).st1 = statement();
+ _localctx.ast.add(((BodyContext)_localctx).st1.ast);
+ }
+ break;
+ case T__5:
+ enterOuterAlt(_localctx, 2);
+ {
+ {
+ setState(223);
+ match(T__5);
+ setState(229);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (((_la) & ~0x3f) == 0 && ((1L << _la) & 8258483918856L) != 0) {
+ {
+ {
+ setState(224);
+ ((BodyContext)_localctx).st2 = statement();
+ _localctx.ast.add(((BodyContext)_localctx).st2.ast);
+ }
+ }
+ setState(231);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(232);
+ match(T__6);
+ }
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class TypeContext extends ParserRuleContext {
+ public Type ast;
+ public List fields = new ArrayList();
+ public Struct struct;
+ public IntLiteral size;
+ public Token ST;
+ public Token F1;
+ public Token F2;
+ public TypeContext t1;
+ public Token SIZE;
+ public TypeContext t;
+ public List ID() { return getTokens(PmmParser.ID); }
+ public TerminalNode ID(int i) {
+ return getToken(PmmParser.ID, i);
+ }
+ public List type() {
+ return getRuleContexts(TypeContext.class);
+ }
+ public TypeContext type(int i) {
+ return getRuleContext(TypeContext.class,i);
+ }
+ public TerminalNode INT_CONSTANT() { return getToken(PmmParser.INT_CONSTANT, 0); }
+ public TypeContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_type; }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof PmmVisitor ) return ((PmmVisitor extends T>)visitor).visitType(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final TypeContext type() throws RecognitionException {
+ TypeContext _localctx = new TypeContext(_ctx, getState());
+ enterRule(_localctx, 8, RULE_type);
+ int _la;
+ try {
+ setState(276);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__33:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(235);
+ match(T__33);
+ ((TypeContext)_localctx).ast = Int.getInstance();
+ }
+ break;
+ case T__34:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(237);
+ match(T__34);
+ ((TypeContext)_localctx).ast = Real.getInstance();
+ }
+ break;
+ case T__35:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(239);
+ match(T__35);
+ ((TypeContext)_localctx).ast = Char.getInstance();
+ }
+ break;
+ case T__36:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(241);
+ ((TypeContext)_localctx).ST = match(T__36);
+ ((TypeContext)_localctx).struct = new Struct(((TypeContext)_localctx).ST.getLine(), ((TypeContext)_localctx).ST.getCharPositionInLine()+1);
+ setState(243);
+ match(T__5);
+ setState(261);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ do {
+ {
+ {
+ setState(244);
+ ((TypeContext)_localctx).F1 = match(ID);
+ for (RecordField field : _localctx.fields) { //for fields in separate lines
+ ErrorType e;
+ if (field.getName().equals((((TypeContext)_localctx).F1!=null?((TypeContext)_localctx).F1.getText():null)))
+ e = new ErrorType(((TypeContext)_localctx).F1.getLine(), ((TypeContext)_localctx).F1.getCharPositionInLine()+1, "Error in line: "
+ + ((TypeContext)_localctx).F1.getLine() + " column: " + ((TypeContext)_localctx).F1.getCharPositionInLine()+1 +
+ ". Field with identifier '" + (((TypeContext)_localctx).F1!=null?((TypeContext)_localctx).F1.getText():null) + "' already defined in scope");
+ }
+
+ _localctx.fields.add(new RecordField(((TypeContext)_localctx).F1.getLine(), ((TypeContext)_localctx).F1.getCharPositionInLine()+1, null, (((TypeContext)_localctx).F1!=null?((TypeContext)_localctx).F1.getText():null)));
+ setState(253);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__24) {
+ {
+ {
+ setState(247);
+ match(T__24);
+ setState(248);
+ ((TypeContext)_localctx).F2 = match(ID);
+ for (RecordField field : _localctx.fields) {//for consecutive declared fields
+ ErrorType e;
+ if (field.getName().equals((((TypeContext)_localctx).F2!=null?((TypeContext)_localctx).F2.getText():null)))
+ e = new ErrorType(((TypeContext)_localctx).F2.getLine(), ((TypeContext)_localctx).F2.getCharPositionInLine()+1, "Error in line: "
+ + ((TypeContext)_localctx).F2.getLine() + " column: " + ((TypeContext)_localctx).F2.getCharPositionInLine()+1 +
+ ". Field with identifier '" + (((TypeContext)_localctx).F2!=null?((TypeContext)_localctx).F2.getText():null) + "' already defined in scope");
+ }
+
+ _localctx.fields.add(new RecordField(((TypeContext)_localctx).F2.getLine(), ((TypeContext)_localctx).F2.getCharPositionInLine()+1, null, (((TypeContext)_localctx).F2!=null?((TypeContext)_localctx).F2.getText():null)));
+ }
+ }
+ setState(255);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(256);
+ match(T__4);
+ setState(257);
+ ((TypeContext)_localctx).t1 = type();
+ setState(258);
+ match(T__26);
+ for (RecordField fd : _localctx.fields) {
+ if (fd.getType() == null)
+ fd.setType(((TypeContext)_localctx).t1.ast);
+ }
+ }
+ }
+ setState(263);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ } while ( _la==ID );
+ setState(265);
+ match(T__6);
+ _localctx.struct.setFields(_localctx.fields);
+ ((TypeContext)_localctx).ast = _localctx.struct;
+ }
+ break;
+ case T__7:
+ enterOuterAlt(_localctx, 5);
+ {
+ {
+ setState(269);
+ match(T__7);
+ setState(270);
+ ((TypeContext)_localctx).SIZE = match(INT_CONSTANT);
+ setState(271);
+ match(T__8);
+ }
+ setState(273);
+ ((TypeContext)_localctx).t = type();
+ ((TypeContext)_localctx).ast = new Array(((TypeContext)_localctx).SIZE.getLine(), ((TypeContext)_localctx).SIZE.getCharPositionInLine()+1, LexerHelper.lexemeToInt((((TypeContext)_localctx).SIZE!=null?((TypeContext)_localctx).SIZE.getText():null)), ((TypeContext)_localctx).t.ast);
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class Func_definitionContext extends ParserRuleContext {
+ public FuncDefinition ast;
+ public List args = new ArrayList();
+ public FunctionType funcType;
+ public Type retType;
+ public Token NAME;
+ public Token ARG1;
+ public TypeContext t1;
+ public Token ARG2;
+ public TypeContext t2;
+ public TypeContext t;
+ public Var_definitionContext def;
+ public StatementContext st;
+ public List ID() { return getTokens(PmmParser.ID); }
+ public TerminalNode ID(int i) {
+ return getToken(PmmParser.ID, i);
+ }
+ public List type() {
+ return getRuleContexts(TypeContext.class);
+ }
+ public TypeContext type(int i) {
+ return getRuleContext(TypeContext.class,i);
+ }
+ public List