# Generated from /home/lin/0-PPL/Assignment/initial/src/main/mc/parser/MC.g4 by ANTLR 4.7.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\61")
        buf.write("\u0146\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\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")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\3\2\3")
        buf.write("\2\3\2\3\3\3\3\3\3\3\3\5\3R\n\3\3\4\3\4\5\4V\n\4\3\5\3")
        buf.write("\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\5\6b\n\6\3\7\3\7\3")
        buf.write("\b\3\b\3\b\3\b\3\b\3\b\5\bl\n\b\3\t\3\t\3\t\3\t\5\tr\n")
        buf.write("\t\3\n\3\n\3\n\5\nw\n\n\3\n\3\n\3\13\3\13\3\13\3\13\3")
        buf.write("\f\3\f\3\f\3\f\3\f\5\f\u0084\n\f\3\r\3\r\3\r\3\r\3\r\5")
        buf.write("\r\u008b\n\r\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3")
        buf.write("\16\5\16\u0096\n\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17")
        buf.write("\3\17\3\17\3\17\3\17\3\17\3\17\3\17\5\17\u00a6\n\17\3")
        buf.write("\20\3\20\6\20\u00aa\n\20\r\20\16\20\u00ab\3\20\3\20\3")
        buf.write("\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21")
        buf.write("\3\21\3\22\3\22\3\22\3\23\3\23\3\23\3\24\3\24\3\24\3\24")
        buf.write("\5\24\u00c6\n\24\3\25\3\25\3\25\3\25\3\25\5\25\u00cd\n")
        buf.write("\25\3\26\3\26\3\26\3\26\3\26\3\26\7\26\u00d5\n\26\f\26")
        buf.write("\16\26\u00d8\13\26\3\27\3\27\3\27\3\27\3\27\3\27\7\27")
        buf.write("\u00e0\n\27\f\27\16\27\u00e3\13\27\3\30\3\30\3\30\3\30")
        buf.write("\3\30\5\30\u00ea\n\30\3\31\3\31\3\31\3\31\3\31\5\31\u00f1")
        buf.write("\n\31\3\32\3\32\3\32\3\32\3\32\3\32\7\32\u00f9\n\32\f")
        buf.write("\32\16\32\u00fc\13\32\3\33\3\33\3\33\3\33\3\33\3\33\7")
        buf.write("\33\u0104\n\33\f\33\16\33\u0107\13\33\3\34\3\34\3\34\5")
        buf.write("\34\u010c\n\34\3\35\3\35\3\35\3\35\3\35\3\35\5\35\u0114")
        buf.write("\n\35\3\36\3\36\3\36\3\36\3\36\5\36\u011b\n\36\3\37\3")
        buf.write("\37\3\37\3\37\3\37\3\37\3\37\5\37\u0124\n\37\3 \3 \3 ")
        buf.write("\3 \3 \7 \u012b\n \f \16 \u012e\13 \5 \u0130\n \3 \3 ")
        buf.write("\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3$\3$\3")
        buf.write("%\3%\3%\2\6*,\62\64&\2\4\6\b\n\f\16\20\22\24\26\30\32")
        buf.write("\34\36 \"$&(*,.\60\62\64\668:<>@BDFH\2\b\4\2\24\24\34")
        buf.write("\34\4\2\25\26\35\36\4\2\20\20\30\30\4\2\21\21\31\32\4")
        buf.write("\2\22\22\30\30\4\2\13\13\r\17\2\u0146\2J\3\2\2\2\4Q\3")
        buf.write("\2\2\2\6U\3\2\2\2\bW\3\2\2\2\na\3\2\2\2\fc\3\2\2\2\16")
        buf.write("k\3\2\2\2\20q\3\2\2\2\22s\3\2\2\2\24z\3\2\2\2\26\u0083")
        buf.write("\3\2\2\2\30\u008a\3\2\2\2\32\u0095\3\2\2\2\34\u00a5\3")
        buf.write("\2\2\2\36\u00a7\3\2\2\2 \u00b1\3\2\2\2\"\u00bb\3\2\2\2")
        buf.write("$\u00be\3\2\2\2&\u00c5\3\2\2\2(\u00cc\3\2\2\2*\u00ce\3")
        buf.write("\2\2\2,\u00d9\3\2\2\2.\u00e9\3\2\2\2\60\u00f0\3\2\2\2")
        buf.write("\62\u00f2\3\2\2\2\64\u00fd\3\2\2\2\66\u010b\3\2\2\28\u0113")
        buf.write("\3\2\2\2:\u011a\3\2\2\2<\u0123\3\2\2\2>\u0125\3\2\2\2")
        buf.write("@\u0133\3\2\2\2B\u0138\3\2\2\2D\u013c\3\2\2\2F\u0141\3")
        buf.write("\2\2\2H\u0143\3\2\2\2JK\5\4\3\2KL\7\2\2\3L\3\3\2\2\2M")
        buf.write("N\5\6\4\2NO\5\4\3\2OR\3\2\2\2PR\5\6\4\2QM\3\2\2\2QP\3")
        buf.write("\2\2\2R\5\3\2\2\2SV\5\24\13\2TV\5\b\5\2US\3\2\2\2UT\3")
        buf.write("\2\2\2V\7\3\2\2\2WX\5\n\6\2XY\5\f\7\2YZ\7#\2\2Z[\5\16")
        buf.write("\b\2[\\\7$\2\2\\]\5\22\n\2]\t\3\2\2\2^b\5F$\2_b\5B\"\2")
        buf.write("`b\7\f\2\2a^\3\2\2\2a_\3\2\2\2a`\3\2\2\2b\13\3\2\2\2c")
        buf.write("d\7*\2\2d\r\3\2\2\2ef\5\20\t\2fg\7&\2\2gh\5\16\b\2hl\3")
        buf.write("\2\2\2il\5\20\t\2jl\3\2\2\2ke\3\2\2\2ki\3\2\2\2kj\3\2")
        buf.write("\2\2l\17\3\2\2\2mn\5F$\2no\7*\2\2or\3\2\2\2pr\5@!\2qm")
        buf.write("\3\2\2\2qp\3\2\2\2r\21\3\2\2\2sv\7!\2\2tw\5\24\13\2uw")
        buf.write("\5\32\16\2vt\3\2\2\2vu\3\2\2\2wx\3\2\2\2xy\7\"\2\2y\23")
        buf.write("\3\2\2\2z{\5F$\2{|\5\26\f\2|}\7%\2\2}\25\3\2\2\2~\177")
        buf.write("\5\30\r\2\177\u0080\7&\2\2\u0080\u0081\5\26\f\2\u0081")
        buf.write("\u0084\3\2\2\2\u0082\u0084\5\30\r\2\u0083~\3\2\2\2\u0083")
        buf.write("\u0082\3\2\2\2\u0084\27\3\2\2\2\u0085\u008b\7*\2\2\u0086")
        buf.write("\u0087\7*\2\2\u0087\u0088\7\37\2\2\u0088\u0089\7)\2\2")
        buf.write("\u0089\u008b\7 \2\2\u008a\u0085\3\2\2\2\u008a\u0086\3")
        buf.write("\2\2\2\u008b\31\3\2\2\2\u008c\u0096\5\34\17\2\u008d\u0096")
        buf.write("\5\36\20\2\u008e\u0096\5 \21\2\u008f\u0096\5\"\22\2\u0090")
        buf.write("\u0096\5$\23\2\u0091\u0096\5&\24\2\u0092\u0093\5(\25\2")
        buf.write("\u0093\u0094\7%\2\2\u0094\u0096\3\2\2\2\u0095\u008c\3")
        buf.write("\2\2\2\u0095\u008d\3\2\2\2\u0095\u008e\3\2\2\2\u0095\u008f")
        buf.write("\3\2\2\2\u0095\u0090\3\2\2\2\u0095\u0091\3\2\2\2\u0095")
        buf.write("\u0092\3\2\2\2\u0096\33\3\2\2\2\u0097\u0098\7\3\2\2\u0098")
        buf.write("\u0099\7#\2\2\u0099\u009a\5(\25\2\u009a\u009b\7$\2\2\u009b")
        buf.write("\u009c\5\32\16\2\u009c\u00a6\3\2\2\2\u009d\u009e\7\3\2")
        buf.write("\2\u009e\u009f\7#\2\2\u009f\u00a0\5(\25\2\u00a0\u00a1")
        buf.write("\7$\2\2\u00a1\u00a2\5\32\16\2\u00a2\u00a3\7\4\2\2\u00a3")
        buf.write("\u00a4\5\32\16\2\u00a4\u00a6\3\2\2\2\u00a5\u0097\3\2\2")
        buf.write("\2\u00a5\u009d\3\2\2\2\u00a6\35\3\2\2\2\u00a7\u00a9\7")
        buf.write("\5\2\2\u00a8\u00aa\5\32\16\2\u00a9\u00a8\3\2\2\2\u00aa")
        buf.write("\u00ab\3\2\2\2\u00ab\u00a9\3\2\2\2\u00ab\u00ac\3\2\2\2")
        buf.write("\u00ac\u00ad\3\2\2\2\u00ad\u00ae\7\6\2\2\u00ae\u00af\5")
        buf.write("(\25\2\u00af\u00b0\7%\2\2\u00b0\37\3\2\2\2\u00b1\u00b2")
        buf.write("\7\7\2\2\u00b2\u00b3\7#\2\2\u00b3\u00b4\5(\25\2\u00b4")
        buf.write("\u00b5\7%\2\2\u00b5\u00b6\5(\25\2\u00b6\u00b7\7%\2\2\u00b7")
        buf.write("\u00b8\5(\25\2\u00b8\u00b9\7$\2\2\u00b9\u00ba\5\32\16")
        buf.write("\2\u00ba!\3\2\2\2\u00bb\u00bc\7\b\2\2\u00bc\u00bd\7%\2")
        buf.write("\2\u00bd#\3\2\2\2\u00be\u00bf\7\t\2\2\u00bf\u00c0\7%\2")
        buf.write("\2\u00c0%\3\2\2\2\u00c1\u00c2\7\n\2\2\u00c2\u00c6\7%\2")
        buf.write("\2\u00c3\u00c4\7\n\2\2\u00c4\u00c6\5(\25\2\u00c5\u00c1")
        buf.write("\3\2\2\2\u00c5\u00c3\3\2\2\2\u00c6\'\3\2\2\2\u00c7\u00c8")
        buf.write("\5*\26\2\u00c8\u00c9\7\27\2\2\u00c9\u00ca\5(\25\2\u00ca")
        buf.write("\u00cd\3\2\2\2\u00cb\u00cd\5*\26\2\u00cc\u00c7\3\2\2\2")
        buf.write("\u00cc\u00cb\3\2\2\2\u00cd)\3\2\2\2\u00ce\u00cf\b\26\1")
        buf.write("\2\u00cf\u00d0\5,\27\2\u00d0\u00d6\3\2\2\2\u00d1\u00d2")
        buf.write("\f\4\2\2\u00d2\u00d3\7\23\2\2\u00d3\u00d5\5,\27\2\u00d4")
        buf.write("\u00d1\3\2\2\2\u00d5\u00d8\3\2\2\2\u00d6\u00d4\3\2\2\2")
        buf.write("\u00d6\u00d7\3\2\2\2\u00d7+\3\2\2\2\u00d8\u00d6\3\2\2")
        buf.write("\2\u00d9\u00da\b\27\1\2\u00da\u00db\5.\30\2\u00db\u00e1")
        buf.write("\3\2\2\2\u00dc\u00dd\f\4\2\2\u00dd\u00de\7\33\2\2\u00de")
        buf.write("\u00e0\5.\30\2\u00df\u00dc\3\2\2\2\u00e0\u00e3\3\2\2\2")
        buf.write("\u00e1\u00df\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2-\3\2\2")
        buf.write("\2\u00e3\u00e1\3\2\2\2\u00e4\u00e5\5\60\31\2\u00e5\u00e6")
        buf.write("\t\2\2\2\u00e6\u00e7\5\60\31\2\u00e7\u00ea\3\2\2\2\u00e8")
        buf.write("\u00ea\5\60\31\2\u00e9\u00e4\3\2\2\2\u00e9\u00e8\3\2\2")
        buf.write("\2\u00ea/\3\2\2\2\u00eb\u00ec\5\62\32\2\u00ec\u00ed\t")
        buf.write("\3\2\2\u00ed\u00ee\5\62\32\2\u00ee\u00f1\3\2\2\2\u00ef")
        buf.write("\u00f1\5\62\32\2\u00f0\u00eb\3\2\2\2\u00f0\u00ef\3\2\2")
        buf.write("\2\u00f1\61\3\2\2\2\u00f2\u00f3\b\32\1\2\u00f3\u00f4\5")
        buf.write("\64\33\2\u00f4\u00fa\3\2\2\2\u00f5\u00f6\f\4\2\2\u00f6")
        buf.write("\u00f7\t\4\2\2\u00f7\u00f9\5\64\33\2\u00f8\u00f5\3\2\2")
        buf.write("\2\u00f9\u00fc\3\2\2\2\u00fa\u00f8\3\2\2\2\u00fa\u00fb")
        buf.write("\3\2\2\2\u00fb\63\3\2\2\2\u00fc\u00fa\3\2\2\2\u00fd\u00fe")
        buf.write("\b\33\1\2\u00fe\u00ff\5\66\34\2\u00ff\u0105\3\2\2\2\u0100")
        buf.write("\u0101\f\4\2\2\u0101\u0102\t\5\2\2\u0102\u0104\5\66\34")
        buf.write("\2\u0103\u0100\3\2\2\2\u0104\u0107\3\2\2\2\u0105\u0103")
        buf.write("\3\2\2\2\u0105\u0106\3\2\2\2\u0106\65\3\2\2\2\u0107\u0105")
        buf.write("\3\2\2\2\u0108\u0109\t\6\2\2\u0109\u010c\5\66\34\2\u010a")
        buf.write("\u010c\58\35\2\u010b\u0108\3\2\2\2\u010b\u010a\3\2\2\2")
        buf.write("\u010c\67\3\2\2\2\u010d\u010e\5:\36\2\u010e\u010f\7\37")
        buf.write("\2\2\u010f\u0110\5(\25\2\u0110\u0111\7 \2\2\u0111\u0114")
        buf.write("\3\2\2\2\u0112\u0114\5:\36\2\u0113\u010d\3\2\2\2\u0113")
        buf.write("\u0112\3\2\2\2\u01149\3\2\2\2\u0115\u0116\7#\2\2\u0116")
        buf.write("\u0117\5(\25\2\u0117\u0118\7$\2\2\u0118\u011b\3\2\2\2")
        buf.write("\u0119\u011b\5<\37\2\u011a\u0115\3\2\2\2\u011a\u0119\3")
        buf.write("\2\2\2\u011b;\3\2\2\2\u011c\u0124\7\'\2\2\u011d\u0124")
        buf.write("\7(\2\2\u011e\u0124\7)\2\2\u011f\u0124\7.\2\2\u0120\u0124")
        buf.write("\7*\2\2\u0121\u0124\5D#\2\u0122\u0124\5> \2\u0123\u011c")
        buf.write("\3\2\2\2\u0123\u011d\3\2\2\2\u0123\u011e\3\2\2\2\u0123")
        buf.write("\u011f\3\2\2\2\u0123\u0120\3\2\2\2\u0123\u0121\3\2\2\2")
        buf.write("\u0123\u0122\3\2\2\2\u0124=\3\2\2\2\u0125\u0126\7*\2\2")
        buf.write("\u0126\u012f\7#\2\2\u0127\u012c\5(\25\2\u0128\u0129\7")
        buf.write("&\2\2\u0129\u012b\5(\25\2\u012a\u0128\3\2\2\2\u012b\u012e")
        buf.write("\3\2\2\2\u012c\u012a\3\2\2\2\u012c\u012d\3\2\2\2\u012d")
        buf.write("\u0130\3\2\2\2\u012e\u012c\3\2\2\2\u012f\u0127\3\2\2\2")
        buf.write("\u012f\u0130\3\2\2\2\u0130\u0131\3\2\2\2\u0131\u0132\7")
        buf.write("$\2\2\u0132?\3\2\2\2\u0133\u0134\5F$\2\u0134\u0135\7*")
        buf.write("\2\2\u0135\u0136\7\37\2\2\u0136\u0137\7 \2\2\u0137A\3")
        buf.write("\2\2\2\u0138\u0139\5F$\2\u0139\u013a\7\37\2\2\u013a\u013b")
        buf.write("\7 \2\2\u013bC\3\2\2\2\u013c\u013d\7*\2\2\u013d\u013e")
        buf.write("\7\37\2\2\u013e\u013f\7)\2\2\u013f\u0140\7 \2\2\u0140")
        buf.write("E\3\2\2\2\u0141\u0142\t\7\2\2\u0142G\3\2\2\2\u0143\u0144")
        buf.write("\3\2\2\2\u0144I\3\2\2\2\33QUakqv\u0083\u008a\u0095\u00a5")
        buf.write("\u00ab\u00c5\u00cc\u00d6\u00e1\u00e9\u00f0\u00fa\u0105")
        buf.write("\u010b\u0113\u011a\u0123\u012c\u012f")
        return buf.getvalue()


class MCParser ( Parser ):

    grammarFileName = "MC.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'if'", "'else'", "'do'", "'while'", "'for'", 
                     "'break'", "'continue'", "'return'", "'int'", "'void'", 
                     "'boolean'", "'float'", "'string'", "'+'", "'*'", "'!'", 
                     "'||'", "'!='", "'<'", "'<='", "'='", "'-'", "'/'", 
                     "'%'", "'&&'", "'=='", "'>'", "'>='", "'['", "']'", 
                     "'{'", "'}'", "'('", "')'", "';'", "','" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "INTTYPE", "VOIDTYPE", "BOOLTYPE", "FLOATTYPE", 
                      "STRINGTYPE", "ADD", "MUL", "NOT", "OR", "NEQ", "LESS", 
                      "ELESS", "ASSIGN", "SUB", "DIV", "MOD", "AND", "EQ", 
                      "GREAT", "EGREAT", "LS", "RS", "LB", "RB", "LP", "RP", 
                      "SEMI", "CM", "BOOLLIT", "FLOATLIT", "INTLIT", "ID", 
                      "WS", "BLOCKCOMMENT", "LINECOMMENT", "STRINGLIT", 
                      "ERROR_CHAR", "UNCLOSE_STRING", "ILLEGAL_ESCAPE" ]

    RULE_program = 0
    RULE_manyDecls = 1
    RULE_decl = 2
    RULE_func_decl = 3
    RULE_func_type = 4
    RULE_func_name = 5
    RULE_para_list = 6
    RULE_one_para = 7
    RULE_block_statement = 8
    RULE_var_decl = 9
    RULE_var_list = 10
    RULE_one_variable = 11
    RULE_statement = 12
    RULE_if_stm = 13
    RULE_do_while_stm = 14
    RULE_for_stm = 15
    RULE_break_stm = 16
    RULE_continue_stm = 17
    RULE_return_stm = 18
    RULE_expression_stm = 19
    RULE_term1 = 20
    RULE_term2 = 21
    RULE_term3 = 22
    RULE_term4 = 23
    RULE_term5 = 24
    RULE_term6 = 25
    RULE_term7 = 26
    RULE_term8 = 27
    RULE_term9 = 28
    RULE_operand = 29
    RULE_invocation = 30
    RULE_array_input = 31
    RULE_array_output = 32
    RULE_array_element = 33
    RULE_primitive_type = 34
    RULE_func_call = 35

    ruleNames =  [ "program", "manyDecls", "decl", "func_decl", "func_type", 
                   "func_name", "para_list", "one_para", "block_statement", 
                   "var_decl", "var_list", "one_variable", "statement", 
                   "if_stm", "do_while_stm", "for_stm", "break_stm", "continue_stm", 
                   "return_stm", "expression_stm", "term1", "term2", "term3", 
                   "term4", "term5", "term6", "term7", "term8", "term9", 
                   "operand", "invocation", "array_input", "array_output", 
                   "array_element", "primitive_type", "func_call" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    INTTYPE=9
    VOIDTYPE=10
    BOOLTYPE=11
    FLOATTYPE=12
    STRINGTYPE=13
    ADD=14
    MUL=15
    NOT=16
    OR=17
    NEQ=18
    LESS=19
    ELESS=20
    ASSIGN=21
    SUB=22
    DIV=23
    MOD=24
    AND=25
    EQ=26
    GREAT=27
    EGREAT=28
    LS=29
    RS=30
    LB=31
    RB=32
    LP=33
    RP=34
    SEMI=35
    CM=36
    BOOLLIT=37
    FLOATLIT=38
    INTLIT=39
    ID=40
    WS=41
    BLOCKCOMMENT=42
    LINECOMMENT=43
    STRINGLIT=44
    ERROR_CHAR=45
    UNCLOSE_STRING=46
    ILLEGAL_ESCAPE=47

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.7.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class ProgramContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def manyDecls(self):
            return self.getTypedRuleContext(MCParser.ManyDeclsContext,0)


        def EOF(self):
            return self.getToken(MCParser.EOF, 0)

        def getRuleIndex(self):
            return MCParser.RULE_program

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterProgram" ):
                listener.enterProgram(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitProgram" ):
                listener.exitProgram(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProgram" ):
                return visitor.visitProgram(self)
            else:
                return visitor.visitChildren(self)




    def program(self):

        localctx = MCParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 72
            self.manyDecls()
            self.state = 73
            self.match(MCParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ManyDeclsContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def decl(self):
            return self.getTypedRuleContext(MCParser.DeclContext,0)


        def manyDecls(self):
            return self.getTypedRuleContext(MCParser.ManyDeclsContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_manyDecls

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterManyDecls" ):
                listener.enterManyDecls(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitManyDecls" ):
                listener.exitManyDecls(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitManyDecls" ):
                return visitor.visitManyDecls(self)
            else:
                return visitor.visitChildren(self)




    def manyDecls(self):

        localctx = MCParser.ManyDeclsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_manyDecls)
        try:
            self.state = 79
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 75
                self.decl()
                self.state = 76
                self.manyDecls()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 78
                self.decl()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeclContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def var_decl(self):
            return self.getTypedRuleContext(MCParser.Var_declContext,0)


        def func_decl(self):
            return self.getTypedRuleContext(MCParser.Func_declContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_decl

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDecl" ):
                listener.enterDecl(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDecl" ):
                listener.exitDecl(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDecl" ):
                return visitor.visitDecl(self)
            else:
                return visitor.visitChildren(self)




    def decl(self):

        localctx = MCParser.DeclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_decl)
        try:
            self.state = 83
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 81
                self.var_decl()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 82
                self.func_decl()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_declContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def func_type(self):
            return self.getTypedRuleContext(MCParser.Func_typeContext,0)


        def func_name(self):
            return self.getTypedRuleContext(MCParser.Func_nameContext,0)


        def LP(self):
            return self.getToken(MCParser.LP, 0)

        def para_list(self):
            return self.getTypedRuleContext(MCParser.Para_listContext,0)


        def RP(self):
            return self.getToken(MCParser.RP, 0)

        def block_statement(self):
            return self.getTypedRuleContext(MCParser.Block_statementContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_func_decl

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc_decl" ):
                listener.enterFunc_decl(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunc_decl" ):
                listener.exitFunc_decl(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunc_decl" ):
                return visitor.visitFunc_decl(self)
            else:
                return visitor.visitChildren(self)




    def func_decl(self):

        localctx = MCParser.Func_declContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_func_decl)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 85
            self.func_type()
            self.state = 86
            self.func_name()
            self.state = 87
            self.match(MCParser.LP)
            self.state = 88
            self.para_list()
            self.state = 89
            self.match(MCParser.RP)
            self.state = 90
            self.block_statement()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_typeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primitive_type(self):
            return self.getTypedRuleContext(MCParser.Primitive_typeContext,0)


        def array_output(self):
            return self.getTypedRuleContext(MCParser.Array_outputContext,0)


        def VOIDTYPE(self):
            return self.getToken(MCParser.VOIDTYPE, 0)

        def getRuleIndex(self):
            return MCParser.RULE_func_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc_type" ):
                listener.enterFunc_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunc_type" ):
                listener.exitFunc_type(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunc_type" ):
                return visitor.visitFunc_type(self)
            else:
                return visitor.visitChildren(self)




    def func_type(self):

        localctx = MCParser.Func_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_func_type)
        try:
            self.state = 95
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 92
                self.primitive_type()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 93
                self.array_output()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 94
                self.match(MCParser.VOIDTYPE)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_nameContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def getRuleIndex(self):
            return MCParser.RULE_func_name

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc_name" ):
                listener.enterFunc_name(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunc_name" ):
                listener.exitFunc_name(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunc_name" ):
                return visitor.visitFunc_name(self)
            else:
                return visitor.visitChildren(self)




    def func_name(self):

        localctx = MCParser.Func_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_func_name)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self.match(MCParser.ID)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Para_listContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def one_para(self):
            return self.getTypedRuleContext(MCParser.One_paraContext,0)


        def CM(self):
            return self.getToken(MCParser.CM, 0)

        def para_list(self):
            return self.getTypedRuleContext(MCParser.Para_listContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_para_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPara_list" ):
                listener.enterPara_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPara_list" ):
                listener.exitPara_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPara_list" ):
                return visitor.visitPara_list(self)
            else:
                return visitor.visitChildren(self)




    def para_list(self):

        localctx = MCParser.Para_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_para_list)
        try:
            self.state = 105
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 99
                self.one_para()
                self.state = 100
                self.match(MCParser.CM)
                self.state = 101
                self.para_list()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 103
                self.one_para()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)

                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class One_paraContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primitive_type(self):
            return self.getTypedRuleContext(MCParser.Primitive_typeContext,0)


        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def array_input(self):
            return self.getTypedRuleContext(MCParser.Array_inputContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_one_para

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOne_para" ):
                listener.enterOne_para(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOne_para" ):
                listener.exitOne_para(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOne_para" ):
                return visitor.visitOne_para(self)
            else:
                return visitor.visitChildren(self)




    def one_para(self):

        localctx = MCParser.One_paraContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_one_para)
        try:
            self.state = 111
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 107
                self.primitive_type()
                self.state = 108
                self.match(MCParser.ID)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 110
                self.array_input()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Block_statementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LB(self):
            return self.getToken(MCParser.LB, 0)

        def RB(self):
            return self.getToken(MCParser.RB, 0)

        def var_decl(self):
            return self.getTypedRuleContext(MCParser.Var_declContext,0)


        def statement(self):
            return self.getTypedRuleContext(MCParser.StatementContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_block_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBlock_statement" ):
                listener.enterBlock_statement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBlock_statement" ):
                listener.exitBlock_statement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBlock_statement" ):
                return visitor.visitBlock_statement(self)
            else:
                return visitor.visitChildren(self)




    def block_statement(self):

        localctx = MCParser.Block_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_block_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 113
            self.match(MCParser.LB)
            self.state = 116
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.INTTYPE, MCParser.BOOLTYPE, MCParser.FLOATTYPE, MCParser.STRINGTYPE]:
                self.state = 114
                self.var_decl()
                pass
            elif token in [MCParser.T__0, MCParser.T__2, MCParser.T__4, MCParser.T__5, MCParser.T__6, MCParser.T__7, MCParser.NOT, MCParser.SUB, MCParser.LP, MCParser.BOOLLIT, MCParser.FLOATLIT, MCParser.INTLIT, MCParser.ID, MCParser.STRINGLIT]:
                self.state = 115
                self.statement()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 118
            self.match(MCParser.RB)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Var_declContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primitive_type(self):
            return self.getTypedRuleContext(MCParser.Primitive_typeContext,0)


        def var_list(self):
            return self.getTypedRuleContext(MCParser.Var_listContext,0)


        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def getRuleIndex(self):
            return MCParser.RULE_var_decl

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVar_decl" ):
                listener.enterVar_decl(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVar_decl" ):
                listener.exitVar_decl(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVar_decl" ):
                return visitor.visitVar_decl(self)
            else:
                return visitor.visitChildren(self)




    def var_decl(self):

        localctx = MCParser.Var_declContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_var_decl)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.primitive_type()
            self.state = 121
            self.var_list()
            self.state = 122
            self.match(MCParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Var_listContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def one_variable(self):
            return self.getTypedRuleContext(MCParser.One_variableContext,0)


        def CM(self):
            return self.getToken(MCParser.CM, 0)

        def var_list(self):
            return self.getTypedRuleContext(MCParser.Var_listContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_var_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVar_list" ):
                listener.enterVar_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVar_list" ):
                listener.exitVar_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVar_list" ):
                return visitor.visitVar_list(self)
            else:
                return visitor.visitChildren(self)




    def var_list(self):

        localctx = MCParser.Var_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_var_list)
        try:
            self.state = 129
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 124
                self.one_variable()
                self.state = 125
                self.match(MCParser.CM)
                self.state = 126
                self.var_list()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 128
                self.one_variable()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class One_variableContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def LS(self):
            return self.getToken(MCParser.LS, 0)

        def INTLIT(self):
            return self.getToken(MCParser.INTLIT, 0)

        def RS(self):
            return self.getToken(MCParser.RS, 0)

        def getRuleIndex(self):
            return MCParser.RULE_one_variable

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOne_variable" ):
                listener.enterOne_variable(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOne_variable" ):
                listener.exitOne_variable(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOne_variable" ):
                return visitor.visitOne_variable(self)
            else:
                return visitor.visitChildren(self)




    def one_variable(self):

        localctx = MCParser.One_variableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_one_variable)
        try:
            self.state = 136
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 131
                self.match(MCParser.ID)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 132
                self.match(MCParser.ID)
                self.state = 133
                self.match(MCParser.LS)
                self.state = 134
                self.match(MCParser.INTLIT)
                self.state = 135
                self.match(MCParser.RS)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def if_stm(self):
            return self.getTypedRuleContext(MCParser.If_stmContext,0)


        def do_while_stm(self):
            return self.getTypedRuleContext(MCParser.Do_while_stmContext,0)


        def for_stm(self):
            return self.getTypedRuleContext(MCParser.For_stmContext,0)


        def break_stm(self):
            return self.getTypedRuleContext(MCParser.Break_stmContext,0)


        def continue_stm(self):
            return self.getTypedRuleContext(MCParser.Continue_stmContext,0)


        def return_stm(self):
            return self.getTypedRuleContext(MCParser.Return_stmContext,0)


        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def getRuleIndex(self):
            return MCParser.RULE_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement" ):
                listener.enterStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement" ):
                listener.exitStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement" ):
                return visitor.visitStatement(self)
            else:
                return visitor.visitChildren(self)




    def statement(self):

        localctx = MCParser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_statement)
        try:
            self.state = 147
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 138
                self.if_stm()
                pass
            elif token in [MCParser.T__2]:
                self.enterOuterAlt(localctx, 2)
                self.state = 139
                self.do_while_stm()
                pass
            elif token in [MCParser.T__4]:
                self.enterOuterAlt(localctx, 3)
                self.state = 140
                self.for_stm()
                pass
            elif token in [MCParser.T__5]:
                self.enterOuterAlt(localctx, 4)
                self.state = 141
                self.break_stm()
                pass
            elif token in [MCParser.T__6]:
                self.enterOuterAlt(localctx, 5)
                self.state = 142
                self.continue_stm()
                pass
            elif token in [MCParser.T__7]:
                self.enterOuterAlt(localctx, 6)
                self.state = 143
                self.return_stm()
                pass
            elif token in [MCParser.NOT, MCParser.SUB, MCParser.LP, MCParser.BOOLLIT, MCParser.FLOATLIT, MCParser.INTLIT, MCParser.ID, MCParser.STRINGLIT]:
                self.enterOuterAlt(localctx, 7)
                self.state = 144
                self.expression_stm()
                self.state = 145
                self.match(MCParser.SEMI)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class If_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LP(self):
            return self.getToken(MCParser.LP, 0)

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def RP(self):
            return self.getToken(MCParser.RP, 0)

        def statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.StatementContext)
            else:
                return self.getTypedRuleContext(MCParser.StatementContext,i)


        def getRuleIndex(self):
            return MCParser.RULE_if_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIf_stm" ):
                listener.enterIf_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIf_stm" ):
                listener.exitIf_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIf_stm" ):
                return visitor.visitIf_stm(self)
            else:
                return visitor.visitChildren(self)




    def if_stm(self):

        localctx = MCParser.If_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_if_stm)
        try:
            self.state = 163
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 149
                self.match(MCParser.T__0)
                self.state = 150
                self.match(MCParser.LP)
                self.state = 151
                self.expression_stm()
                self.state = 152
                self.match(MCParser.RP)
                self.state = 153
                self.statement()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 155
                self.match(MCParser.T__0)
                self.state = 156
                self.match(MCParser.LP)
                self.state = 157
                self.expression_stm()
                self.state = 158
                self.match(MCParser.RP)
                self.state = 159
                self.statement()
                self.state = 160
                self.match(MCParser.T__1)
                self.state = 161
                self.statement()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Do_while_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.StatementContext)
            else:
                return self.getTypedRuleContext(MCParser.StatementContext,i)


        def getRuleIndex(self):
            return MCParser.RULE_do_while_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDo_while_stm" ):
                listener.enterDo_while_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDo_while_stm" ):
                listener.exitDo_while_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDo_while_stm" ):
                return visitor.visitDo_while_stm(self)
            else:
                return visitor.visitChildren(self)




    def do_while_stm(self):

        localctx = MCParser.Do_while_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_do_while_stm)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 165
            self.match(MCParser.T__2)
            self.state = 167 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 166
                self.statement()
                self.state = 169 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.T__0) | (1 << MCParser.T__2) | (1 << MCParser.T__4) | (1 << MCParser.T__5) | (1 << MCParser.T__6) | (1 << MCParser.T__7) | (1 << MCParser.NOT) | (1 << MCParser.SUB) | (1 << MCParser.LP) | (1 << MCParser.BOOLLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.INTLIT) | (1 << MCParser.ID) | (1 << MCParser.STRINGLIT))) != 0)):
                    break

            self.state = 171
            self.match(MCParser.T__3)
            self.state = 172
            self.expression_stm()
            self.state = 173
            self.match(MCParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class For_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LP(self):
            return self.getToken(MCParser.LP, 0)

        def expression_stm(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Expression_stmContext)
            else:
                return self.getTypedRuleContext(MCParser.Expression_stmContext,i)


        def SEMI(self, i:int=None):
            if i is None:
                return self.getTokens(MCParser.SEMI)
            else:
                return self.getToken(MCParser.SEMI, i)

        def RP(self):
            return self.getToken(MCParser.RP, 0)

        def statement(self):
            return self.getTypedRuleContext(MCParser.StatementContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_for_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFor_stm" ):
                listener.enterFor_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFor_stm" ):
                listener.exitFor_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFor_stm" ):
                return visitor.visitFor_stm(self)
            else:
                return visitor.visitChildren(self)




    def for_stm(self):

        localctx = MCParser.For_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_for_stm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 175
            self.match(MCParser.T__4)
            self.state = 176
            self.match(MCParser.LP)
            self.state = 177
            self.expression_stm()
            self.state = 178
            self.match(MCParser.SEMI)
            self.state = 179
            self.expression_stm()
            self.state = 180
            self.match(MCParser.SEMI)
            self.state = 181
            self.expression_stm()
            self.state = 182
            self.match(MCParser.RP)
            self.state = 183
            self.statement()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Break_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def getRuleIndex(self):
            return MCParser.RULE_break_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBreak_stm" ):
                listener.enterBreak_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBreak_stm" ):
                listener.exitBreak_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBreak_stm" ):
                return visitor.visitBreak_stm(self)
            else:
                return visitor.visitChildren(self)




    def break_stm(self):

        localctx = MCParser.Break_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_break_stm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 185
            self.match(MCParser.T__5)
            self.state = 186
            self.match(MCParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Continue_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def getRuleIndex(self):
            return MCParser.RULE_continue_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterContinue_stm" ):
                listener.enterContinue_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitContinue_stm" ):
                listener.exitContinue_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitContinue_stm" ):
                return visitor.visitContinue_stm(self)
            else:
                return visitor.visitChildren(self)




    def continue_stm(self):

        localctx = MCParser.Continue_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_continue_stm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            self.match(MCParser.T__6)
            self.state = 189
            self.match(MCParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Return_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SEMI(self):
            return self.getToken(MCParser.SEMI, 0)

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_return_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReturn_stm" ):
                listener.enterReturn_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReturn_stm" ):
                listener.exitReturn_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReturn_stm" ):
                return visitor.visitReturn_stm(self)
            else:
                return visitor.visitChildren(self)




    def return_stm(self):

        localctx = MCParser.Return_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_return_stm)
        try:
            self.state = 195
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 191
                self.match(MCParser.T__7)
                self.state = 192
                self.match(MCParser.SEMI)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 193
                self.match(MCParser.T__7)
                self.state = 194
                self.expression_stm()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Expression_stmContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term1(self):
            return self.getTypedRuleContext(MCParser.Term1Context,0)


        def ASSIGN(self):
            return self.getToken(MCParser.ASSIGN, 0)

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_expression_stm

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpression_stm" ):
                listener.enterExpression_stm(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpression_stm" ):
                listener.exitExpression_stm(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_stm" ):
                return visitor.visitExpression_stm(self)
            else:
                return visitor.visitChildren(self)




    def expression_stm(self):

        localctx = MCParser.Expression_stmContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_expression_stm)
        try:
            self.state = 202
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 197
                self.term1(0)
                self.state = 198
                self.match(MCParser.ASSIGN)
                self.state = 199
                self.expression_stm()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 201
                self.term1(0)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Term1Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term2(self):
            return self.getTypedRuleContext(MCParser.Term2Context,0)


        def term1(self):
            return self.getTypedRuleContext(MCParser.Term1Context,0)


        def OR(self):
            return self.getToken(MCParser.OR, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term1

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm1" ):
                listener.enterTerm1(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm1" ):
                listener.exitTerm1(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm1" ):
                return visitor.visitTerm1(self)
            else:
                return visitor.visitChildren(self)



    def term1(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Term1Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 40
        self.enterRecursionRule(localctx, 40, self.RULE_term1, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 205
            self.term2(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 212
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,13,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = MCParser.Term1Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_term1)
                    self.state = 207
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 208
                    self.match(MCParser.OR)
                    self.state = 209
                    self.term2(0) 
                self.state = 214
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,13,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Term2Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term3(self):
            return self.getTypedRuleContext(MCParser.Term3Context,0)


        def term2(self):
            return self.getTypedRuleContext(MCParser.Term2Context,0)


        def AND(self):
            return self.getToken(MCParser.AND, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term2

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm2" ):
                listener.enterTerm2(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm2" ):
                listener.exitTerm2(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm2" ):
                return visitor.visitTerm2(self)
            else:
                return visitor.visitChildren(self)



    def term2(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Term2Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 42
        self.enterRecursionRule(localctx, 42, self.RULE_term2, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 216
            self.term3()
            self._ctx.stop = self._input.LT(-1)
            self.state = 223
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,14,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = MCParser.Term2Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_term2)
                    self.state = 218
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 219
                    self.match(MCParser.AND)
                    self.state = 220
                    self.term3() 
                self.state = 225
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,14,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Term3Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term4(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Term4Context)
            else:
                return self.getTypedRuleContext(MCParser.Term4Context,i)


        def EQ(self):
            return self.getToken(MCParser.EQ, 0)

        def NEQ(self):
            return self.getToken(MCParser.NEQ, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term3

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm3" ):
                listener.enterTerm3(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm3" ):
                listener.exitTerm3(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm3" ):
                return visitor.visitTerm3(self)
            else:
                return visitor.visitChildren(self)




    def term3(self):

        localctx = MCParser.Term3Context(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_term3)
        self._la = 0 # Token type
        try:
            self.state = 231
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 226
                self.term4()
                self.state = 227
                _la = self._input.LA(1)
                if not(_la==MCParser.NEQ or _la==MCParser.EQ):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 228
                self.term4()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 230
                self.term4()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Term4Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term5(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Term5Context)
            else:
                return self.getTypedRuleContext(MCParser.Term5Context,i)


        def LESS(self):
            return self.getToken(MCParser.LESS, 0)

        def ELESS(self):
            return self.getToken(MCParser.ELESS, 0)

        def GREAT(self):
            return self.getToken(MCParser.GREAT, 0)

        def EGREAT(self):
            return self.getToken(MCParser.EGREAT, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term4

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm4" ):
                listener.enterTerm4(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm4" ):
                listener.exitTerm4(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm4" ):
                return visitor.visitTerm4(self)
            else:
                return visitor.visitChildren(self)




    def term4(self):

        localctx = MCParser.Term4Context(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_term4)
        self._la = 0 # Token type
        try:
            self.state = 238
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 233
                self.term5(0)
                self.state = 234
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.LESS) | (1 << MCParser.ELESS) | (1 << MCParser.GREAT) | (1 << MCParser.EGREAT))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 235
                self.term5(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 237
                self.term5(0)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Term5Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term6(self):
            return self.getTypedRuleContext(MCParser.Term6Context,0)


        def term5(self):
            return self.getTypedRuleContext(MCParser.Term5Context,0)


        def ADD(self):
            return self.getToken(MCParser.ADD, 0)

        def SUB(self):
            return self.getToken(MCParser.SUB, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term5

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm5" ):
                listener.enterTerm5(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm5" ):
                listener.exitTerm5(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm5" ):
                return visitor.visitTerm5(self)
            else:
                return visitor.visitChildren(self)



    def term5(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Term5Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 48
        self.enterRecursionRule(localctx, 48, self.RULE_term5, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 241
            self.term6(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 248
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,17,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = MCParser.Term5Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_term5)
                    self.state = 243
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 244
                    _la = self._input.LA(1)
                    if not(_la==MCParser.ADD or _la==MCParser.SUB):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 245
                    self.term6(0) 
                self.state = 250
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,17,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Term6Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term7(self):
            return self.getTypedRuleContext(MCParser.Term7Context,0)


        def term6(self):
            return self.getTypedRuleContext(MCParser.Term6Context,0)


        def DIV(self):
            return self.getToken(MCParser.DIV, 0)

        def MUL(self):
            return self.getToken(MCParser.MUL, 0)

        def MOD(self):
            return self.getToken(MCParser.MOD, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term6

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm6" ):
                listener.enterTerm6(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm6" ):
                listener.exitTerm6(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm6" ):
                return visitor.visitTerm6(self)
            else:
                return visitor.visitChildren(self)



    def term6(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Term6Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 50
        self.enterRecursionRule(localctx, 50, self.RULE_term6, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 252
            self.term7()
            self._ctx.stop = self._input.LT(-1)
            self.state = 259
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,18,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = MCParser.Term6Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_term6)
                    self.state = 254
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 255
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.MUL) | (1 << MCParser.DIV) | (1 << MCParser.MOD))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 256
                    self.term7() 
                self.state = 261
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,18,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Term7Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term7(self):
            return self.getTypedRuleContext(MCParser.Term7Context,0)


        def SUB(self):
            return self.getToken(MCParser.SUB, 0)

        def NOT(self):
            return self.getToken(MCParser.NOT, 0)

        def term8(self):
            return self.getTypedRuleContext(MCParser.Term8Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_term7

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm7" ):
                listener.enterTerm7(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm7" ):
                listener.exitTerm7(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm7" ):
                return visitor.visitTerm7(self)
            else:
                return visitor.visitChildren(self)




    def term7(self):

        localctx = MCParser.Term7Context(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_term7)
        self._la = 0 # Token type
        try:
            self.state = 265
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.NOT, MCParser.SUB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 262
                _la = self._input.LA(1)
                if not(_la==MCParser.NOT or _la==MCParser.SUB):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 263
                self.term7()
                pass
            elif token in [MCParser.LP, MCParser.BOOLLIT, MCParser.FLOATLIT, MCParser.INTLIT, MCParser.ID, MCParser.STRINGLIT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 264
                self.term8()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Term8Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def term9(self):
            return self.getTypedRuleContext(MCParser.Term9Context,0)


        def LS(self):
            return self.getToken(MCParser.LS, 0)

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def RS(self):
            return self.getToken(MCParser.RS, 0)

        def getRuleIndex(self):
            return MCParser.RULE_term8

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm8" ):
                listener.enterTerm8(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm8" ):
                listener.exitTerm8(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm8" ):
                return visitor.visitTerm8(self)
            else:
                return visitor.visitChildren(self)




    def term8(self):

        localctx = MCParser.Term8Context(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_term8)
        try:
            self.state = 273
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 267
                self.term9()

                self.state = 268
                self.match(MCParser.LS)
                self.state = 269
                self.expression_stm()
                self.state = 270
                self.match(MCParser.RS)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 272
                self.term9()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Term9Context(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LP(self):
            return self.getToken(MCParser.LP, 0)

        def expression_stm(self):
            return self.getTypedRuleContext(MCParser.Expression_stmContext,0)


        def RP(self):
            return self.getToken(MCParser.RP, 0)

        def operand(self):
            return self.getTypedRuleContext(MCParser.OperandContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_term9

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTerm9" ):
                listener.enterTerm9(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTerm9" ):
                listener.exitTerm9(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTerm9" ):
                return visitor.visitTerm9(self)
            else:
                return visitor.visitChildren(self)




    def term9(self):

        localctx = MCParser.Term9Context(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_term9)
        try:
            self.state = 280
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LP]:
                self.enterOuterAlt(localctx, 1)
                self.state = 275
                self.match(MCParser.LP)
                self.state = 276
                self.expression_stm()
                self.state = 277
                self.match(MCParser.RP)
                pass
            elif token in [MCParser.BOOLLIT, MCParser.FLOATLIT, MCParser.INTLIT, MCParser.ID, MCParser.STRINGLIT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 279
                self.operand()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OperandContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BOOLLIT(self):
            return self.getToken(MCParser.BOOLLIT, 0)

        def FLOATLIT(self):
            return self.getToken(MCParser.FLOATLIT, 0)

        def INTLIT(self):
            return self.getToken(MCParser.INTLIT, 0)

        def STRINGLIT(self):
            return self.getToken(MCParser.STRINGLIT, 0)

        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def array_element(self):
            return self.getTypedRuleContext(MCParser.Array_elementContext,0)


        def invocation(self):
            return self.getTypedRuleContext(MCParser.InvocationContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_operand

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOperand" ):
                listener.enterOperand(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOperand" ):
                listener.exitOperand(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperand" ):
                return visitor.visitOperand(self)
            else:
                return visitor.visitChildren(self)




    def operand(self):

        localctx = MCParser.OperandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_operand)
        try:
            self.state = 289
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 282
                self.match(MCParser.BOOLLIT)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 283
                self.match(MCParser.FLOATLIT)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 284
                self.match(MCParser.INTLIT)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 285
                self.match(MCParser.STRINGLIT)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 286
                self.match(MCParser.ID)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 287
                self.array_element()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 288
                self.invocation()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class InvocationContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def LP(self):
            return self.getToken(MCParser.LP, 0)

        def RP(self):
            return self.getToken(MCParser.RP, 0)

        def expression_stm(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Expression_stmContext)
            else:
                return self.getTypedRuleContext(MCParser.Expression_stmContext,i)


        def CM(self, i:int=None):
            if i is None:
                return self.getTokens(MCParser.CM)
            else:
                return self.getToken(MCParser.CM, i)

        def getRuleIndex(self):
            return MCParser.RULE_invocation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterInvocation" ):
                listener.enterInvocation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitInvocation" ):
                listener.exitInvocation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInvocation" ):
                return visitor.visitInvocation(self)
            else:
                return visitor.visitChildren(self)




    def invocation(self):

        localctx = MCParser.InvocationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_invocation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 291
            self.match(MCParser.ID)
            self.state = 292
            self.match(MCParser.LP)
            self.state = 301
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.NOT) | (1 << MCParser.SUB) | (1 << MCParser.LP) | (1 << MCParser.BOOLLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.INTLIT) | (1 << MCParser.ID) | (1 << MCParser.STRINGLIT))) != 0):
                self.state = 293
                self.expression_stm()
                self.state = 298
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==MCParser.CM:
                    self.state = 294
                    self.match(MCParser.CM)
                    self.state = 295
                    self.expression_stm()
                    self.state = 300
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 303
            self.match(MCParser.RP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Array_inputContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primitive_type(self):
            return self.getTypedRuleContext(MCParser.Primitive_typeContext,0)


        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def LS(self):
            return self.getToken(MCParser.LS, 0)

        def RS(self):
            return self.getToken(MCParser.RS, 0)

        def getRuleIndex(self):
            return MCParser.RULE_array_input

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray_input" ):
                listener.enterArray_input(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray_input" ):
                listener.exitArray_input(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArray_input" ):
                return visitor.visitArray_input(self)
            else:
                return visitor.visitChildren(self)




    def array_input(self):

        localctx = MCParser.Array_inputContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_array_input)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 305
            self.primitive_type()
            self.state = 306
            self.match(MCParser.ID)
            self.state = 307
            self.match(MCParser.LS)
            self.state = 308
            self.match(MCParser.RS)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Array_outputContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def primitive_type(self):
            return self.getTypedRuleContext(MCParser.Primitive_typeContext,0)


        def LS(self):
            return self.getToken(MCParser.LS, 0)

        def RS(self):
            return self.getToken(MCParser.RS, 0)

        def getRuleIndex(self):
            return MCParser.RULE_array_output

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray_output" ):
                listener.enterArray_output(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray_output" ):
                listener.exitArray_output(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArray_output" ):
                return visitor.visitArray_output(self)
            else:
                return visitor.visitChildren(self)




    def array_output(self):

        localctx = MCParser.Array_outputContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_array_output)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 310
            self.primitive_type()
            self.state = 311
            self.match(MCParser.LS)
            self.state = 312
            self.match(MCParser.RS)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Array_elementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(MCParser.ID, 0)

        def LS(self):
            return self.getToken(MCParser.LS, 0)

        def INTLIT(self):
            return self.getToken(MCParser.INTLIT, 0)

        def RS(self):
            return self.getToken(MCParser.RS, 0)

        def getRuleIndex(self):
            return MCParser.RULE_array_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray_element" ):
                listener.enterArray_element(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray_element" ):
                listener.exitArray_element(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArray_element" ):
                return visitor.visitArray_element(self)
            else:
                return visitor.visitChildren(self)




    def array_element(self):

        localctx = MCParser.Array_elementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_array_element)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 314
            self.match(MCParser.ID)
            self.state = 315
            self.match(MCParser.LS)
            self.state = 316
            self.match(MCParser.INTLIT)
            self.state = 317
            self.match(MCParser.RS)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Primitive_typeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def INTTYPE(self):
            return self.getToken(MCParser.INTTYPE, 0)

        def BOOLTYPE(self):
            return self.getToken(MCParser.BOOLTYPE, 0)

        def FLOATTYPE(self):
            return self.getToken(MCParser.FLOATTYPE, 0)

        def STRINGTYPE(self):
            return self.getToken(MCParser.STRINGTYPE, 0)

        def getRuleIndex(self):
            return MCParser.RULE_primitive_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimitive_type" ):
                listener.enterPrimitive_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimitive_type" ):
                listener.exitPrimitive_type(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimitive_type" ):
                return visitor.visitPrimitive_type(self)
            else:
                return visitor.visitChildren(self)




    def primitive_type(self):

        localctx = MCParser.Primitive_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_primitive_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 319
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.INTTYPE) | (1 << MCParser.BOOLTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_callContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return MCParser.RULE_func_call

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc_call" ):
                listener.enterFunc_call(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunc_call" ):
                listener.exitFunc_call(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunc_call" ):
                return visitor.visitFunc_call(self)
            else:
                return visitor.visitChildren(self)




    def func_call(self):

        localctx = MCParser.Func_callContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_func_call)
        try:
            self.enterOuterAlt(localctx, 1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[20] = self.term1_sempred
        self._predicates[21] = self.term2_sempred
        self._predicates[24] = self.term5_sempred
        self._predicates[25] = self.term6_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def term1_sempred(self, localctx:Term1Context, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

    def term2_sempred(self, localctx:Term2Context, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 2)
         

    def term5_sempred(self, localctx:Term5Context, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 2)
         

    def term6_sempred(self, localctx:Term6Context, predIndex:int):
            if predIndex == 3:
                return self.precpred(self._ctx, 2)
         




