# Generated from 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\64")
        buf.write("\u0156\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\"\3\2\3\2\3\2\3\3\3\3\3\3")
        buf.write("\3\3\5\3L\n\3\3\4\3\4\5\4P\n\4\3\5\3\5\3\5\3\5\7\5V\n")
        buf.write("\5\f\5\16\5Y\13\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\5\6b\n\6")
        buf.write("\3\7\3\7\3\7\3\7\5\7h\n\7\3\7\3\7\3\7\3\b\3\b\3\b\5\b")
        buf.write("p\n\b\3\t\3\t\3\t\3\t\3\t\5\tw\n\t\3\n\3\n\3\n\3\n\3\n")
        buf.write("\3\n\3\n\3\n\5\n\u0081\n\n\3\13\3\13\7\13\u0085\n\13\f")
        buf.write("\13\16\13\u0088\13\13\3\13\3\13\3\f\3\f\5\f\u008e\n\f")
        buf.write("\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u0098\n\r\3\16\3")
        buf.write("\16\3\16\3\16\3\16\3\16\3\16\5\16\u00a1\n\16\3\17\3\17")
        buf.write("\6\17\u00a5\n\17\r\17\16\17\u00a6\3\17\3\17\3\17\3\17")
        buf.write("\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\21")
        buf.write("\3\21\3\21\3\22\3\22\3\22\3\23\3\23\5\23\u00bf\n\23\3")
        buf.write("\23\3\23\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25\5\25")
        buf.write("\u00cb\n\25\3\26\3\26\3\26\3\26\3\26\3\26\7\26\u00d3\n")
        buf.write("\26\f\26\16\26\u00d6\13\26\3\27\3\27\3\27\3\27\3\27\3")
        buf.write("\27\7\27\u00de\n\27\f\27\16\27\u00e1\13\27\3\30\3\30\3")
        buf.write("\30\3\30\3\30\3\30\3\30\3\30\3\30\5\30\u00ec\n\30\3\31")
        buf.write("\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
        buf.write("\3\31\3\31\3\31\3\31\3\31\5\31\u00ff\n\31\3\32\3\32\3")
        buf.write("\32\3\32\3\32\3\32\3\32\3\32\3\32\7\32\u010a\n\32\f\32")
        buf.write("\16\32\u010d\13\32\3\33\3\33\3\33\3\33\3\33\3\33\3\33")
        buf.write("\3\33\3\33\3\33\3\33\3\33\7\33\u011b\n\33\f\33\16\33\u011e")
        buf.write("\13\33\3\34\3\34\3\34\3\34\3\34\5\34\u0125\n\34\3\35\3")
        buf.write("\35\3\35\3\35\3\35\3\35\5\35\u012d\n\35\3\36\3\36\3\36")
        buf.write("\3\36\3\36\3\36\3\36\3\36\3\36\3\36\5\36\u0139\n\36\5")
        buf.write("\36\u013b\n\36\3\37\3\37\3\37\3\37\3\37\7\37\u0142\n\37")
        buf.write("\f\37\16\37\u0145\13\37\5\37\u0147\n\37\3\37\3\37\3 \3")
        buf.write(" \3 \3 \3 \3!\3!\3!\3!\3\"\3\"\3\"\2\6*,\62\64#\2\4\6")
        buf.write("\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\66")
        buf.write("8:<>@B\2\3\6\2\n\n\17\17\21\21\30\30\2\u0162\2D\3\2\2")
        buf.write("\2\4K\3\2\2\2\6O\3\2\2\2\bQ\3\2\2\2\na\3\2\2\2\fc\3\2")
        buf.write("\2\2\16o\3\2\2\2\20v\3\2\2\2\22\u0080\3\2\2\2\24\u0082")
        buf.write("\3\2\2\2\26\u008d\3\2\2\2\30\u0097\3\2\2\2\32\u0099\3")
        buf.write("\2\2\2\34\u00a2\3\2\2\2\36\u00ac\3\2\2\2 \u00b6\3\2\2")
        buf.write("\2\"\u00b9\3\2\2\2$\u00bc\3\2\2\2&\u00c2\3\2\2\2(\u00ca")
        buf.write("\3\2\2\2*\u00cc\3\2\2\2,\u00d7\3\2\2\2.\u00eb\3\2\2\2")
        buf.write("\60\u00fe\3\2\2\2\62\u0100\3\2\2\2\64\u010e\3\2\2\2\66")
        buf.write("\u0124\3\2\2\28\u012c\3\2\2\2:\u013a\3\2\2\2<\u013c\3")
        buf.write("\2\2\2>\u014a\3\2\2\2@\u014f\3\2\2\2B\u0153\3\2\2\2DE")
        buf.write("\5\4\3\2EF\7\2\2\3F\3\3\2\2\2GH\5\6\4\2HI\5\4\3\2IL\3")
        buf.write("\2\2\2JL\5\6\4\2KG\3\2\2\2KJ\3\2\2\2L\5\3\2\2\2MP\5\b")
        buf.write("\5\2NP\5\f\7\2OM\3\2\2\2ON\3\2\2\2P\7\3\2\2\2QR\5B\"\2")
        buf.write("RW\5\n\6\2ST\7\60\2\2TV\5\n\6\2US\3\2\2\2VY\3\2\2\2WU")
        buf.write("\3\2\2\2WX\3\2\2\2XZ\3\2\2\2YW\3\2\2\2Z[\7/\2\2[\t\3\2")
        buf.write("\2\2\\b\7(\2\2]^\7(\2\2^_\7-\2\2_`\7\6\2\2`b\7.\2\2a\\")
        buf.write("\3\2\2\2a]\3\2\2\2b\13\3\2\2\2cd\5\16\b\2de\7(\2\2eg\7")
        buf.write(")\2\2fh\5\20\t\2gf\3\2\2\2gh\3\2\2\2hi\3\2\2\2ij\7*\2")
        buf.write("\2jk\5\24\13\2k\r\3\2\2\2lp\5B\"\2mp\5@!\2np\7\23\2\2")
        buf.write("ol\3\2\2\2om\3\2\2\2on\3\2\2\2p\17\3\2\2\2qr\5\22\n\2")
        buf.write("rs\7\60\2\2st\5\20\t\2tw\3\2\2\2uw\5\22\n\2vq\3\2\2\2")
        buf.write("vu\3\2\2\2w\21\3\2\2\2xy\5B\"\2yz\7(\2\2z\u0081\3\2\2")
        buf.write("\2{|\5B\"\2|}\7(\2\2}~\7-\2\2~\177\7.\2\2\177\u0081\3")
        buf.write("\2\2\2\u0080x\3\2\2\2\u0080{\3\2\2\2\u0081\23\3\2\2\2")
        buf.write("\u0082\u0086\7+\2\2\u0083\u0085\5\26\f\2\u0084\u0083\3")
        buf.write("\2\2\2\u0085\u0088\3\2\2\2\u0086\u0084\3\2\2\2\u0086\u0087")
        buf.write("\3\2\2\2\u0087\u0089\3\2\2\2\u0088\u0086\3\2\2\2\u0089")
        buf.write("\u008a\7,\2\2\u008a\25\3\2\2\2\u008b\u008e\5\b\5\2\u008c")
        buf.write("\u008e\5\30\r\2\u008d\u008b\3\2\2\2\u008d\u008c\3\2\2")
        buf.write("\2\u008e\27\3\2\2\2\u008f\u0098\5\32\16\2\u0090\u0098")
        buf.write("\5\34\17\2\u0091\u0098\5\36\20\2\u0092\u0098\5 \21\2\u0093")
        buf.write("\u0098\5\"\22\2\u0094\u0098\5$\23\2\u0095\u0098\5&\24")
        buf.write("\2\u0096\u0098\5\24\13\2\u0097\u008f\3\2\2\2\u0097\u0090")
        buf.write("\3\2\2\2\u0097\u0091\3\2\2\2\u0097\u0092\3\2\2\2\u0097")
        buf.write("\u0093\3\2\2\2\u0097\u0094\3\2\2\2\u0097\u0095\3\2\2\2")
        buf.write("\u0097\u0096\3\2\2\2\u0098\31\3\2\2\2\u0099\u009a\7\20")
        buf.write("\2\2\u009a\u009b\7)\2\2\u009b\u009c\5(\25\2\u009c\u009d")
        buf.write("\7*\2\2\u009d\u00a0\5\30\r\2\u009e\u009f\7\r\2\2\u009f")
        buf.write("\u00a1\5\30\r\2\u00a0\u009e\3\2\2\2\u00a0\u00a1\3\2\2")
        buf.write("\2\u00a1\33\3\2\2\2\u00a2\u00a4\7\24\2\2\u00a3\u00a5\5")
        buf.write("\30\r\2\u00a4\u00a3\3\2\2\2\u00a5\u00a6\3\2\2\2\u00a6")
        buf.write("\u00a4\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a8\3\2\2\2")
        buf.write("\u00a8\u00a9\7\25\2\2\u00a9\u00aa\5(\25\2\u00aa\u00ab")
        buf.write("\7/\2\2\u00ab\35\3\2\2\2\u00ac\u00ad\7\16\2\2\u00ad\u00ae")
        buf.write("\7)\2\2\u00ae\u00af\5(\25\2\u00af\u00b0\7/\2\2\u00b0\u00b1")
        buf.write("\5(\25\2\u00b1\u00b2\7/\2\2\u00b2\u00b3\5(\25\2\u00b3")
        buf.write("\u00b4\7*\2\2\u00b4\u00b5\5\30\r\2\u00b5\37\3\2\2\2\u00b6")
        buf.write("\u00b7\7\13\2\2\u00b7\u00b8\7/\2\2\u00b8!\3\2\2\2\u00b9")
        buf.write("\u00ba\7\f\2\2\u00ba\u00bb\7/\2\2\u00bb#\3\2\2\2\u00bc")
        buf.write("\u00be\7\22\2\2\u00bd\u00bf\5(\25\2\u00be\u00bd\3\2\2")
        buf.write("\2\u00be\u00bf\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\u00c1")
        buf.write("\7/\2\2\u00c1%\3\2\2\2\u00c2\u00c3\5(\25\2\u00c3\u00c4")
        buf.write("\7/\2\2\u00c4\'\3\2\2\2\u00c5\u00c6\5*\26\2\u00c6\u00c7")
        buf.write("\7\'\2\2\u00c7\u00c8\5(\25\2\u00c8\u00cb\3\2\2\2\u00c9")
        buf.write("\u00cb\5*\26\2\u00ca\u00c5\3\2\2\2\u00ca\u00c9\3\2\2\2")
        buf.write("\u00cb)\3\2\2\2\u00cc\u00cd\b\26\1\2\u00cd\u00ce\5,\27")
        buf.write("\2\u00ce\u00d4\3\2\2\2\u00cf\u00d0\f\4\2\2\u00d0\u00d1")
        buf.write("\7\37\2\2\u00d1\u00d3\5,\27\2\u00d2\u00cf\3\2\2\2\u00d3")
        buf.write("\u00d6\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d4\u00d5\3\2\2\2")
        buf.write("\u00d5+\3\2\2\2\u00d6\u00d4\3\2\2\2\u00d7\u00d8\b\27\1")
        buf.write("\2\u00d8\u00d9\5.\30\2\u00d9\u00df\3\2\2\2\u00da\u00db")
        buf.write("\f\4\2\2\u00db\u00dc\7 \2\2\u00dc\u00de\5.\30\2\u00dd")
        buf.write("\u00da\3\2\2\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2")
        buf.write("\u00df\u00e0\3\2\2\2\u00e0-\3\2\2\2\u00e1\u00df\3\2\2")
        buf.write("\2\u00e2\u00e3\5\60\31\2\u00e3\u00e4\7!\2\2\u00e4\u00e5")
        buf.write("\5\60\31\2\u00e5\u00ec\3\2\2\2\u00e6\u00e7\5\60\31\2\u00e7")
        buf.write("\u00e8\7\"\2\2\u00e8\u00e9\5\60\31\2\u00e9\u00ec\3\2\2")
        buf.write("\2\u00ea\u00ec\5\60\31\2\u00eb\u00e2\3\2\2\2\u00eb\u00e6")
        buf.write("\3\2\2\2\u00eb\u00ea\3\2\2\2\u00ec/\3\2\2\2\u00ed\u00ee")
        buf.write("\5\62\32\2\u00ee\u00ef\7#\2\2\u00ef\u00f0\5\62\32\2\u00f0")
        buf.write("\u00ff\3\2\2\2\u00f1\u00f2\5\62\32\2\u00f2\u00f3\7$\2")
        buf.write("\2\u00f3\u00f4\5\62\32\2\u00f4\u00ff\3\2\2\2\u00f5\u00f6")
        buf.write("\5\62\32\2\u00f6\u00f7\7%\2\2\u00f7\u00f8\5\62\32\2\u00f8")
        buf.write("\u00ff\3\2\2\2\u00f9\u00fa\5\62\32\2\u00fa\u00fb\7&\2")
        buf.write("\2\u00fb\u00fc\5\62\32\2\u00fc\u00ff\3\2\2\2\u00fd\u00ff")
        buf.write("\5\62\32\2\u00fe\u00ed\3\2\2\2\u00fe\u00f1\3\2\2\2\u00fe")
        buf.write("\u00f5\3\2\2\2\u00fe\u00f9\3\2\2\2\u00fe\u00fd\3\2\2\2")
        buf.write("\u00ff\61\3\2\2\2\u0100\u0101\b\32\1\2\u0101\u0102\5\64")
        buf.write("\33\2\u0102\u010b\3\2\2\2\u0103\u0104\f\5\2\2\u0104\u0105")
        buf.write("\7\31\2\2\u0105\u010a\5\64\33\2\u0106\u0107\f\4\2\2\u0107")
        buf.write("\u0108\7\32\2\2\u0108\u010a\5\64\33\2\u0109\u0103\3\2")
        buf.write("\2\2\u0109\u0106\3\2\2\2\u010a\u010d\3\2\2\2\u010b\u0109")
        buf.write("\3\2\2\2\u010b\u010c\3\2\2\2\u010c\63\3\2\2\2\u010d\u010b")
        buf.write("\3\2\2\2\u010e\u010f\b\33\1\2\u010f\u0110\5\66\34\2\u0110")
        buf.write("\u011c\3\2\2\2\u0111\u0112\f\6\2\2\u0112\u0113\7\34\2")
        buf.write("\2\u0113\u011b\5\66\34\2\u0114\u0115\f\5\2\2\u0115\u0116")
        buf.write("\7\33\2\2\u0116\u011b\5\66\34\2\u0117\u0118\f\4\2\2\u0118")
        buf.write("\u0119\7\35\2\2\u0119\u011b\5\66\34\2\u011a\u0111\3\2")
        buf.write("\2\2\u011a\u0114\3\2\2\2\u011a\u0117\3\2\2\2\u011b\u011e")
        buf.write("\3\2\2\2\u011c\u011a\3\2\2\2\u011c\u011d\3\2\2\2\u011d")
        buf.write("\65\3\2\2\2\u011e\u011c\3\2\2\2\u011f\u0120\7\36\2\2\u0120")
        buf.write("\u0125\5\66\34\2\u0121\u0122\7\32\2\2\u0122\u0125\5\66")
        buf.write("\34\2\u0123\u0125\58\35\2\u0124\u011f\3\2\2\2\u0124\u0121")
        buf.write("\3\2\2\2\u0124\u0123\3\2\2\2\u0125\67\3\2\2\2\u0126\u0127")
        buf.write("\5:\36\2\u0127\u0128\7-\2\2\u0128\u0129\5(\25\2\u0129")
        buf.write("\u012a\7.\2\2\u012a\u012d\3\2\2\2\u012b\u012d\5:\36\2")
        buf.write("\u012c\u0126\3\2\2\2\u012c\u012b\3\2\2\2\u012d9\3\2\2")
        buf.write("\2\u012e\u012f\7)\2\2\u012f\u0130\5(\25\2\u0130\u0131")
        buf.write("\7*\2\2\u0131\u013b\3\2\2\2\u0132\u0139\7\6\2\2\u0133")
        buf.write("\u0139\7\7\2\2\u0134\u0139\7\b\2\2\u0135\u0139\7\t\2\2")
        buf.write("\u0136\u0139\7(\2\2\u0137\u0139\5<\37\2\u0138\u0132\3")
        buf.write("\2\2\2\u0138\u0133\3\2\2\2\u0138\u0134\3\2\2\2\u0138\u0135")
        buf.write("\3\2\2\2\u0138\u0136\3\2\2\2\u0138\u0137\3\2\2\2\u0139")
        buf.write("\u013b\3\2\2\2\u013a\u012e\3\2\2\2\u013a\u0138\3\2\2\2")
        buf.write("\u013b;\3\2\2\2\u013c\u013d\7(\2\2\u013d\u0146\7)\2\2")
        buf.write("\u013e\u0143\5(\25\2\u013f\u0140\7\60\2\2\u0140\u0142")
        buf.write("\5(\25\2\u0141\u013f\3\2\2\2\u0142\u0145\3\2\2\2\u0143")
        buf.write("\u0141\3\2\2\2\u0143\u0144\3\2\2\2\u0144\u0147\3\2\2\2")
        buf.write("\u0145\u0143\3\2\2\2\u0146\u013e\3\2\2\2\u0146\u0147\3")
        buf.write("\2\2\2\u0147\u0148\3\2\2\2\u0148\u0149\7*\2\2\u0149=\3")
        buf.write("\2\2\2\u014a\u014b\5B\"\2\u014b\u014c\7(\2\2\u014c\u014d")
        buf.write("\7-\2\2\u014d\u014e\7.\2\2\u014e?\3\2\2\2\u014f\u0150")
        buf.write("\5B\"\2\u0150\u0151\7-\2\2\u0151\u0152\7.\2\2\u0152A\3")
        buf.write("\2\2\2\u0153\u0154\t\2\2\2\u0154C\3\2\2\2\37KOWagov\u0080")
        buf.write("\u0086\u008d\u0097\u00a0\u00a6\u00be\u00ca\u00d4\u00df")
        buf.write("\u00eb\u00fe\u0109\u010b\u011a\u011c\u0124\u012c\u0138")
        buf.write("\u013a\u0143\u0146")
        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>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'boolean'", "'break'", "'continue'", "'else'", "'for'", 
                     "'float'", "'if'", "'int'", "'return'", "'void'", "'do'", 
                     "'while'", "'true'", "'false'", "'string'", "'+'", 
                     "'-'", "'*'", "'/'", "'%'", "'!'", "'||'", "'&&'", 
                     "'=='", "'!='", "'<'", "'<='", "'>'", "'>='", "'='", 
                     "<INVALID>", "'('", "')'", "'{'", "'}'", "'['", "']'", 
                     "';'", "','" ]

    symbolicNames = [ "<INVALID>", "WS", "BLOCK_COMMENT", "LINE_COMMENT", 
                      "INTLIT", "FLOATLIT", "BOOLEANLIT", "STRINGLIT", "BOOLEAN", 
                      "BREAK", "CONTINUE", "ELSE", "FOR", "FLOAT", "IF", 
                      "INT", "RETURN", "VOID", "DO", "WHILE", "TRUE", "FALSE", 
                      "STRING", "ADD", "SUB", "MUL", "DIV", "MOD", "NOT", 
                      "OR", "AND", "EQ", "NEQ", "LT", "LEQ", "GT", "GEQ", 
                      "ASSIGN", "ID", "LB", "RB", "LP", "RP", "LS", "RS", 
                      "SEMI", "COMMA", "ERROR_CHAR", "ILLEGAL_ESCAPE", "UNCLOSE_STRING", 
                      "NL" ]

    RULE_program = 0
    RULE_manyDecls = 1
    RULE_decl = 2
    RULE_varDecl = 3
    RULE_var = 4
    RULE_funcDecl = 5
    RULE_returnType = 6
    RULE_paraList = 7
    RULE_paraDecl = 8
    RULE_blockStmt = 9
    RULE_blockMem = 10
    RULE_stmt = 11
    RULE_ifStmt = 12
    RULE_dowhileStmt = 13
    RULE_forStmt = 14
    RULE_breakStmt = 15
    RULE_contStmt = 16
    RULE_returnStmt = 17
    RULE_expStmt = 18
    RULE_exp = 19
    RULE_exp1 = 20
    RULE_exp2 = 21
    RULE_exp3 = 22
    RULE_exp4 = 23
    RULE_exp5 = 24
    RULE_exp6 = 25
    RULE_exp7 = 26
    RULE_exp8 = 27
    RULE_exp9 = 28
    RULE_invokeExp = 29
    RULE_inArrPtrType = 30
    RULE_outArrPtrType = 31
    RULE_primType = 32

    ruleNames =  [ "program", "manyDecls", "decl", "varDecl", "var", "funcDecl", 
                   "returnType", "paraList", "paraDecl", "blockStmt", "blockMem", 
                   "stmt", "ifStmt", "dowhileStmt", "forStmt", "breakStmt", 
                   "contStmt", "returnStmt", "expStmt", "exp", "exp1", "exp2", 
                   "exp3", "exp4", "exp5", "exp6", "exp7", "exp8", "exp9", 
                   "invokeExp", "inArrPtrType", "outArrPtrType", "primType" ]

    EOF = Token.EOF
    WS=1
    BLOCK_COMMENT=2
    LINE_COMMENT=3
    INTLIT=4
    FLOATLIT=5
    BOOLEANLIT=6
    STRINGLIT=7
    BOOLEAN=8
    BREAK=9
    CONTINUE=10
    ELSE=11
    FOR=12
    FLOAT=13
    IF=14
    INT=15
    RETURN=16
    VOID=17
    DO=18
    WHILE=19
    TRUE=20
    FALSE=21
    STRING=22
    ADD=23
    SUB=24
    MUL=25
    DIV=26
    MOD=27
    NOT=28
    OR=29
    AND=30
    EQ=31
    NEQ=32
    LT=33
    LEQ=34
    GT=35
    GEQ=36
    ASSIGN=37
    ID=38
    LB=39
    RB=40
    LP=41
    RP=42
    LS=43
    RS=44
    SEMI=45
    COMMA=46
    ERROR_CHAR=47
    ILLEGAL_ESCAPE=48
    UNCLOSE_STRING=49
    NL=50

    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 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 = 66
            self.manyDecls()
            self.state = 67
            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 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 = 73
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 69
                self.decl()
                self.state = 70
                self.manyDecls()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 72
                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 varDecl(self):
            return self.getTypedRuleContext(MCParser.VarDeclContext,0)


        def funcDecl(self):
            return self.getTypedRuleContext(MCParser.FuncDeclContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_decl

        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 = 77
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 75
                self.varDecl()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 76
                self.funcDecl()
                pass


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


    class VarDeclContext(ParserRuleContext):

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

        def primType(self):
            return self.getTypedRuleContext(MCParser.PrimTypeContext,0)


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


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

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

        def getRuleIndex(self):
            return MCParser.RULE_varDecl

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




    def varDecl(self):

        localctx = MCParser.VarDeclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_varDecl)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 79
            self.primType()
            self.state = 80
            self.var()
            self.state = 85
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MCParser.COMMA:
                self.state = 81
                self.match(MCParser.COMMA)
                self.state = 82
                self.var()
                self.state = 87
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 88
            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 VarContext(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_var

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




    def var(self):

        localctx = MCParser.VarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_var)
        try:
            self.state = 95
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 90
                self.match(MCParser.ID)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 91
                self.match(MCParser.ID)
                self.state = 92
                self.match(MCParser.LS)
                self.state = 93
                self.match(MCParser.INTLIT)
                self.state = 94
                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 FuncDeclContext(ParserRuleContext):

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

        def returnType(self):
            return self.getTypedRuleContext(MCParser.ReturnTypeContext,0)


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

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

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

        def blockStmt(self):
            return self.getTypedRuleContext(MCParser.BlockStmtContext,0)


        def paraList(self):
            return self.getTypedRuleContext(MCParser.ParaListContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_funcDecl

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




    def funcDecl(self):

        localctx = MCParser.FuncDeclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_funcDecl)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self.returnType()
            self.state = 98
            self.match(MCParser.ID)
            self.state = 99
            self.match(MCParser.LB)
            self.state = 101
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEAN) | (1 << MCParser.FLOAT) | (1 << MCParser.INT) | (1 << MCParser.STRING))) != 0):
                self.state = 100
                self.paraList()


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


    class ReturnTypeContext(ParserRuleContext):

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

        def primType(self):
            return self.getTypedRuleContext(MCParser.PrimTypeContext,0)


        def outArrPtrType(self):
            return self.getTypedRuleContext(MCParser.OutArrPtrTypeContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_returnType

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




    def returnType(self):

        localctx = MCParser.ReturnTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_returnType)
        try:
            self.state = 109
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 106
                self.primType()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 107
                self.outArrPtrType()
                pass

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


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


    class ParaListContext(ParserRuleContext):

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

        def paraDecl(self):
            return self.getTypedRuleContext(MCParser.ParaDeclContext,0)


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

        def paraList(self):
            return self.getTypedRuleContext(MCParser.ParaListContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_paraList

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




    def paraList(self):

        localctx = MCParser.ParaListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_paraList)
        try:
            self.state = 116
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 111
                self.paraDecl()
                self.state = 112
                self.match(MCParser.COMMA)
                self.state = 113
                self.paraList()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 115
                self.paraDecl()
                pass


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


    class ParaDeclContext(ParserRuleContext):

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

        def primType(self):
            return self.getTypedRuleContext(MCParser.PrimTypeContext,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_paraDecl

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




    def paraDecl(self):

        localctx = MCParser.ParaDeclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_paraDecl)
        try:
            self.state = 126
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 118
                self.primType()
                self.state = 119
                self.match(MCParser.ID)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 121
                self.primType()
                self.state = 122
                self.match(MCParser.ID)
                self.state = 123
                self.match(MCParser.LS)
                self.state = 124
                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 BlockStmtContext(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 RP(self):
            return self.getToken(MCParser.RP, 0)

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


        def getRuleIndex(self):
            return MCParser.RULE_blockStmt

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




    def blockStmt(self):

        localctx = MCParser.BlockStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_blockStmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 128
            self.match(MCParser.LP)
            self.state = 132
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.INTLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.BOOLEANLIT) | (1 << MCParser.STRINGLIT) | (1 << MCParser.BOOLEAN) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.FOR) | (1 << MCParser.FLOAT) | (1 << MCParser.IF) | (1 << MCParser.INT) | (1 << MCParser.RETURN) | (1 << MCParser.DO) | (1 << MCParser.STRING) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.ID) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0):
                self.state = 129
                self.blockMem()
                self.state = 134
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 135
            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 BlockMemContext(ParserRuleContext):

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

        def varDecl(self):
            return self.getTypedRuleContext(MCParser.VarDeclContext,0)


        def stmt(self):
            return self.getTypedRuleContext(MCParser.StmtContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_blockMem

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




    def blockMem(self):

        localctx = MCParser.BlockMemContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_blockMem)
        try:
            self.state = 139
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.BOOLEAN, MCParser.FLOAT, MCParser.INT, MCParser.STRING]:
                self.enterOuterAlt(localctx, 1)
                self.state = 137
                self.varDecl()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.BREAK, MCParser.CONTINUE, MCParser.FOR, MCParser.IF, MCParser.RETURN, MCParser.DO, MCParser.SUB, MCParser.NOT, MCParser.ID, MCParser.LB, MCParser.LP]:
                self.enterOuterAlt(localctx, 2)
                self.state = 138
                self.stmt()
                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 StmtContext(ParserRuleContext):

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

        def ifStmt(self):
            return self.getTypedRuleContext(MCParser.IfStmtContext,0)


        def dowhileStmt(self):
            return self.getTypedRuleContext(MCParser.DowhileStmtContext,0)


        def forStmt(self):
            return self.getTypedRuleContext(MCParser.ForStmtContext,0)


        def breakStmt(self):
            return self.getTypedRuleContext(MCParser.BreakStmtContext,0)


        def contStmt(self):
            return self.getTypedRuleContext(MCParser.ContStmtContext,0)


        def returnStmt(self):
            return self.getTypedRuleContext(MCParser.ReturnStmtContext,0)


        def expStmt(self):
            return self.getTypedRuleContext(MCParser.ExpStmtContext,0)


        def blockStmt(self):
            return self.getTypedRuleContext(MCParser.BlockStmtContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_stmt

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




    def stmt(self):

        localctx = MCParser.StmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_stmt)
        try:
            self.state = 149
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.IF]:
                self.enterOuterAlt(localctx, 1)
                self.state = 141
                self.ifStmt()
                pass
            elif token in [MCParser.DO]:
                self.enterOuterAlt(localctx, 2)
                self.state = 142
                self.dowhileStmt()
                pass
            elif token in [MCParser.FOR]:
                self.enterOuterAlt(localctx, 3)
                self.state = 143
                self.forStmt()
                pass
            elif token in [MCParser.BREAK]:
                self.enterOuterAlt(localctx, 4)
                self.state = 144
                self.breakStmt()
                pass
            elif token in [MCParser.CONTINUE]:
                self.enterOuterAlt(localctx, 5)
                self.state = 145
                self.contStmt()
                pass
            elif token in [MCParser.RETURN]:
                self.enterOuterAlt(localctx, 6)
                self.state = 146
                self.returnStmt()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.SUB, MCParser.NOT, MCParser.ID, MCParser.LB]:
                self.enterOuterAlt(localctx, 7)
                self.state = 147
                self.expStmt()
                pass
            elif token in [MCParser.LP]:
                self.enterOuterAlt(localctx, 8)
                self.state = 148
                self.blockStmt()
                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 IfStmtContext(ParserRuleContext):

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

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

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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


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

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


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

        def getRuleIndex(self):
            return MCParser.RULE_ifStmt

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




    def ifStmt(self):

        localctx = MCParser.IfStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_ifStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151
            self.match(MCParser.IF)
            self.state = 152
            self.match(MCParser.LB)
            self.state = 153
            self.exp()
            self.state = 154
            self.match(MCParser.RB)
            self.state = 155
            self.stmt()
            self.state = 158
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 156
                self.match(MCParser.ELSE)
                self.state = 157
                self.stmt()


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


    class DowhileStmtContext(ParserRuleContext):

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

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

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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


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

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


        def getRuleIndex(self):
            return MCParser.RULE_dowhileStmt

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




    def dowhileStmt(self):

        localctx = MCParser.DowhileStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_dowhileStmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 160
            self.match(MCParser.DO)
            self.state = 162 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 161
                self.stmt()
                self.state = 164 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.INTLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.BOOLEANLIT) | (1 << MCParser.STRINGLIT) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.FOR) | (1 << MCParser.IF) | (1 << MCParser.RETURN) | (1 << MCParser.DO) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.ID) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0)):
                    break

            self.state = 166
            self.match(MCParser.WHILE)
            self.state = 167
            self.exp()
            self.state = 168
            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 ForStmtContext(ParserRuleContext):

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

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

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

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


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

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

        def stmt(self):
            return self.getTypedRuleContext(MCParser.StmtContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_forStmt

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




    def forStmt(self):

        localctx = MCParser.ForStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_forStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 170
            self.match(MCParser.FOR)
            self.state = 171
            self.match(MCParser.LB)
            self.state = 172
            self.exp()
            self.state = 173
            self.match(MCParser.SEMI)
            self.state = 174
            self.exp()
            self.state = 175
            self.match(MCParser.SEMI)
            self.state = 176
            self.exp()
            self.state = 177
            self.match(MCParser.RB)
            self.state = 178
            self.stmt()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BreakStmtContext(ParserRuleContext):

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_breakStmt

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




    def breakStmt(self):

        localctx = MCParser.BreakStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_breakStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 180
            self.match(MCParser.BREAK)
            self.state = 181
            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 ContStmtContext(ParserRuleContext):

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_contStmt

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




    def contStmt(self):

        localctx = MCParser.ContStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_contStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(MCParser.CONTINUE)
            self.state = 184
            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 ReturnStmtContext(ParserRuleContext):

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

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

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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_returnStmt

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




    def returnStmt(self):

        localctx = MCParser.ReturnStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_returnStmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 186
            self.match(MCParser.RETURN)
            self.state = 188
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.INTLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.BOOLEANLIT) | (1 << MCParser.STRINGLIT) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.ID) | (1 << MCParser.LB))) != 0):
                self.state = 187
                self.exp()


            self.state = 190
            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 ExpStmtContext(ParserRuleContext):

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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expStmt

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




    def expStmt(self):

        localctx = MCParser.ExpStmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_expStmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.exp()
            self.state = 193
            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 ExpContext(ParserRuleContext):

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

        def exp1(self):
            return self.getTypedRuleContext(MCParser.Exp1Context,0)


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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_exp

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




    def exp(self):

        localctx = MCParser.ExpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_exp)
        try:
            self.state = 200
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 195
                self.exp1(0)
                self.state = 196
                self.match(MCParser.ASSIGN)
                self.state = 197
                self.exp()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 199
                self.exp1(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 Exp1Context(ParserRuleContext):

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

        def exp2(self):
            return self.getTypedRuleContext(MCParser.Exp2Context,0)


        def exp1(self):
            return self.getTypedRuleContext(MCParser.Exp1Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_exp1

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



    def exp1(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Exp1Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 40
        self.enterRecursionRule(localctx, 40, self.RULE_exp1, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 203
            self.exp2(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 210
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,15,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.Exp1Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exp1)
                    self.state = 205
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 206
                    self.match(MCParser.OR)
                    self.state = 207
                    self.exp2(0) 
                self.state = 212
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,15,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 Exp2Context(ParserRuleContext):

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

        def exp3(self):
            return self.getTypedRuleContext(MCParser.Exp3Context,0)


        def exp2(self):
            return self.getTypedRuleContext(MCParser.Exp2Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_exp2

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



    def exp2(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Exp2Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 42
        self.enterRecursionRule(localctx, 42, self.RULE_exp2, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 214
            self.exp3()
            self._ctx.stop = self._input.LT(-1)
            self.state = 221
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,16,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.Exp2Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exp2)
                    self.state = 216
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 217
                    self.match(MCParser.AND)
                    self.state = 218
                    self.exp3() 
                self.state = 223
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,16,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 Exp3Context(ParserRuleContext):

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

        def exp4(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Exp4Context)
            else:
                return self.getTypedRuleContext(MCParser.Exp4Context,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_exp3

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




    def exp3(self):

        localctx = MCParser.Exp3Context(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_exp3)
        try:
            self.state = 233
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,17,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 224
                self.exp4()
                self.state = 225
                self.match(MCParser.EQ)
                self.state = 226
                self.exp4()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 228
                self.exp4()
                self.state = 229
                self.match(MCParser.NEQ)
                self.state = 230
                self.exp4()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 232
                self.exp4()
                pass


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


    class Exp4Context(ParserRuleContext):

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

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


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

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_exp4

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




    def exp4(self):

        localctx = MCParser.Exp4Context(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_exp4)
        try:
            self.state = 252
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 235
                self.exp5(0)
                self.state = 236
                self.match(MCParser.LT)
                self.state = 237
                self.exp5(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 239
                self.exp5(0)
                self.state = 240
                self.match(MCParser.LEQ)
                self.state = 241
                self.exp5(0)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 243
                self.exp5(0)
                self.state = 244
                self.match(MCParser.GT)
                self.state = 245
                self.exp5(0)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 247
                self.exp5(0)
                self.state = 248
                self.match(MCParser.GEQ)
                self.state = 249
                self.exp5(0)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 251
                self.exp5(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 Exp5Context(ParserRuleContext):

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

        def exp6(self):
            return self.getTypedRuleContext(MCParser.Exp6Context,0)


        def exp5(self):
            return self.getTypedRuleContext(MCParser.Exp5Context,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_exp5

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



    def exp5(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Exp5Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 48
        self.enterRecursionRule(localctx, 48, self.RULE_exp5, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 255
            self.exp6(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 265
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,20,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 263
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
                    if la_ == 1:
                        localctx = MCParser.Exp5Context(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exp5)
                        self.state = 257
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 258
                        self.match(MCParser.ADD)
                        self.state = 259
                        self.exp6(0)
                        pass

                    elif la_ == 2:
                        localctx = MCParser.Exp5Context(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exp5)
                        self.state = 260
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 261
                        self.match(MCParser.SUB)
                        self.state = 262
                        self.exp6(0)
                        pass

             
                self.state = 267
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,20,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 Exp6Context(ParserRuleContext):

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

        def exp7(self):
            return self.getTypedRuleContext(MCParser.Exp7Context,0)


        def exp6(self):
            return self.getTypedRuleContext(MCParser.Exp6Context,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_exp6

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



    def exp6(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Exp6Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 50
        self.enterRecursionRule(localctx, 50, self.RULE_exp6, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 269
            self.exp7()
            self._ctx.stop = self._input.LT(-1)
            self.state = 282
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,22,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 280
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
                    if la_ == 1:
                        localctx = MCParser.Exp6Context(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exp6)
                        self.state = 271
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 272
                        self.match(MCParser.DIV)
                        self.state = 273
                        self.exp7()
                        pass

                    elif la_ == 2:
                        localctx = MCParser.Exp6Context(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exp6)
                        self.state = 274
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 275
                        self.match(MCParser.MUL)
                        self.state = 276
                        self.exp7()
                        pass

                    elif la_ == 3:
                        localctx = MCParser.Exp6Context(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exp6)
                        self.state = 277
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 278
                        self.match(MCParser.MOD)
                        self.state = 279
                        self.exp7()
                        pass

             
                self.state = 284
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,22,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 Exp7Context(ParserRuleContext):

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

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

        def exp7(self):
            return self.getTypedRuleContext(MCParser.Exp7Context,0)


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

        def exp8(self):
            return self.getTypedRuleContext(MCParser.Exp8Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_exp7

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




    def exp7(self):

        localctx = MCParser.Exp7Context(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_exp7)
        try:
            self.state = 290
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.NOT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 285
                self.match(MCParser.NOT)
                self.state = 286
                self.exp7()
                pass
            elif token in [MCParser.SUB]:
                self.enterOuterAlt(localctx, 2)
                self.state = 287
                self.match(MCParser.SUB)
                self.state = 288
                self.exp7()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID, MCParser.LB]:
                self.enterOuterAlt(localctx, 3)
                self.state = 289
                self.exp8()
                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 Exp8Context(ParserRuleContext):

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

        def exp9(self):
            return self.getTypedRuleContext(MCParser.Exp9Context,0)


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

        def exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_exp8

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




    def exp8(self):

        localctx = MCParser.Exp8Context(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_exp8)
        try:
            self.state = 298
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 292
                self.exp9()
                self.state = 293
                self.match(MCParser.LS)
                self.state = 294
                self.exp()
                self.state = 295
                self.match(MCParser.RS)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 297
                self.exp9()
                pass


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


    class Exp9Context(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 exp(self):
            return self.getTypedRuleContext(MCParser.ExpContext,0)


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

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

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

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

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

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

        def invokeExp(self):
            return self.getTypedRuleContext(MCParser.InvokeExpContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_exp9

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




    def exp9(self):

        localctx = MCParser.Exp9Context(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_exp9)
        try:
            self.state = 312
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 300
                self.match(MCParser.LB)
                self.state = 301
                self.exp()
                self.state = 302
                self.match(MCParser.RB)
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID]:
                self.enterOuterAlt(localctx, 2)
                self.state = 310
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,25,self._ctx)
                if la_ == 1:
                    self.state = 304
                    self.match(MCParser.INTLIT)
                    pass

                elif la_ == 2:
                    self.state = 305
                    self.match(MCParser.FLOATLIT)
                    pass

                elif la_ == 3:
                    self.state = 306
                    self.match(MCParser.BOOLEANLIT)
                    pass

                elif la_ == 4:
                    self.state = 307
                    self.match(MCParser.STRINGLIT)
                    pass

                elif la_ == 5:
                    self.state = 308
                    self.match(MCParser.ID)
                    pass

                elif la_ == 6:
                    self.state = 309
                    self.invokeExp()
                    pass


                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 InvokeExpContext(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 LB(self):
            return self.getToken(MCParser.LB, 0)

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

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


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

        def getRuleIndex(self):
            return MCParser.RULE_invokeExp

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




    def invokeExp(self):

        localctx = MCParser.InvokeExpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_invokeExp)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 314
            self.match(MCParser.ID)
            self.state = 315
            self.match(MCParser.LB)
            self.state = 324
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.INTLIT) | (1 << MCParser.FLOATLIT) | (1 << MCParser.BOOLEANLIT) | (1 << MCParser.STRINGLIT) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.ID) | (1 << MCParser.LB))) != 0):
                self.state = 316
                self.exp()
                self.state = 321
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==MCParser.COMMA:
                    self.state = 317
                    self.match(MCParser.COMMA)
                    self.state = 318
                    self.exp()
                    self.state = 323
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 326
            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 InArrPtrTypeContext(ParserRuleContext):

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

        def primType(self):
            return self.getTypedRuleContext(MCParser.PrimTypeContext,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_inArrPtrType

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




    def inArrPtrType(self):

        localctx = MCParser.InArrPtrTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_inArrPtrType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 328
            self.primType()
            self.state = 329
            self.match(MCParser.ID)
            self.state = 330
            self.match(MCParser.LS)
            self.state = 331
            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 OutArrPtrTypeContext(ParserRuleContext):

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

        def primType(self):
            return self.getTypedRuleContext(MCParser.PrimTypeContext,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_outArrPtrType

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




    def outArrPtrType(self):

        localctx = MCParser.OutArrPtrTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_outArrPtrType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 333
            self.primType()
            self.state = 334
            self.match(MCParser.LS)
            self.state = 335
            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 PrimTypeContext(ParserRuleContext):

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

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

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_primType

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




    def primType(self):

        localctx = MCParser.PrimTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_primType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 337
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEAN) | (1 << MCParser.FLOAT) | (1 << MCParser.INT) | (1 << MCParser.STRING))) != 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



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[20] = self.exp1_sempred
        self._predicates[21] = self.exp2_sempred
        self._predicates[24] = self.exp5_sempred
        self._predicates[25] = self.exp6_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 exp1_sempred(self, localctx:Exp1Context, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

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

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

            if predIndex == 3:
                return self.precpred(self._ctx, 2)
         

    def exp6_sempred(self, localctx:Exp6Context, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 6:
                return self.precpred(self._ctx, 2)
         




