<filename>assignment/assignment1/main/mc/parser/.antlr/MCParser.py
# Generated from /home/kraken/ppl-course/assignment/assignment1/main/mc/parser/MC.g4 by ANTLR 4.7.1
# 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\63")
        buf.write("\u012f\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\6\2G\n\2\r\2\16")
        buf.write("\2H\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\5\3\5\3\5\7\5V\n")
        buf.write("\5\f\5\16\5Y\13\5\3\6\3\6\3\6\3\6\5\6_\n\6\3\7\3\7\3\7")
        buf.write("\3\7\5\7e\n\7\3\7\3\7\3\7\3\b\3\b\3\b\5\bm\n\b\3\t\3\t")
        buf.write("\3\t\3\t\3\n\3\n\3\n\7\nv\n\n\f\n\16\ny\13\n\3\13\3\13")
        buf.write("\3\13\3\f\3\f\3\f\5\f\u0081\n\f\3\r\3\r\3\r\7\r\u0086")
        buf.write("\n\r\f\r\16\r\u0089\13\r\3\r\3\r\3\16\3\16\3\16\3\16\3")
        buf.write("\16\3\16\3\16\3\16\5\16\u0095\n\16\3\17\3\17\3\17\3\17")
        buf.write("\3\17\3\17\3\17\5\17\u009e\n\17\3\20\3\20\6\20\u00a2\n")
        buf.write("\20\r\20\16\20\u00a3\3\20\3\20\3\20\3\20\3\21\3\21\3\21")
        buf.write("\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\23")
        buf.write("\3\23\3\23\3\24\3\24\5\24\u00bc\n\24\3\24\3\24\3\25\3")
        buf.write("\25\3\25\3\26\3\26\3\26\3\26\3\26\5\26\u00c8\n\26\3\27")
        buf.write("\3\27\3\27\3\27\3\27\3\27\7\27\u00d0\n\27\f\27\16\27\u00d3")
        buf.write("\13\27\3\30\3\30\3\30\3\30\3\30\3\30\7\30\u00db\n\30\f")
        buf.write("\30\16\30\u00de\13\30\3\31\3\31\3\31\3\31\3\31\5\31\u00e5")
        buf.write("\n\31\3\32\3\32\3\32\3\32\3\32\5\32\u00ec\n\32\3\33\3")
        buf.write("\33\3\33\3\33\3\33\3\33\7\33\u00f4\n\33\f\33\16\33\u00f7")
        buf.write("\13\33\3\34\3\34\3\34\3\34\3\34\3\34\7\34\u00ff\n\34\f")
        buf.write("\34\16\34\u0102\13\34\3\35\3\35\3\35\5\35\u0107\n\35\3")
        buf.write("\36\3\36\3\36\3\36\3\36\3\36\5\36\u010f\n\36\3\37\3\37")
        buf.write("\3\37\3\37\3\37\5\37\u0116\n\37\3 \3 \3 \3 \3 \3 \5 \u011e")
        buf.write("\n \3!\3!\3!\3!\3!\3\"\3\"\3\"\7\"\u0128\n\"\f\"\16\"")
        buf.write("\u012b\13\"\5\"\u012d\n\"\3\"\2\6,.\64\66#\2\4\6\b\n\f")
        buf.write("\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@")
        buf.write("B\2\b\3\2\7\n\3\2\37 \3\2!$\3\2\27\30\3\2\31\33\4\2\30")
        buf.write("\30\34\34\2\u0133\2F\3\2\2\2\4L\3\2\2\2\6P\3\2\2\2\bR")
        buf.write("\3\2\2\2\nZ\3\2\2\2\f`\3\2\2\2\16l\3\2\2\2\20n\3\2\2\2")
        buf.write("\22r\3\2\2\2\24z\3\2\2\2\26}\3\2\2\2\30\u0082\3\2\2\2")
        buf.write("\32\u0094\3\2\2\2\34\u0096\3\2\2\2\36\u009f\3\2\2\2 \u00a9")
        buf.write("\3\2\2\2\"\u00b3\3\2\2\2$\u00b6\3\2\2\2&\u00b9\3\2\2\2")
        buf.write("(\u00bf\3\2\2\2*\u00c7\3\2\2\2,\u00c9\3\2\2\2.\u00d4\3")
        buf.write("\2\2\2\60\u00e4\3\2\2\2\62\u00eb\3\2\2\2\64\u00ed\3\2")
        buf.write("\2\2\66\u00f8\3\2\2\28\u0106\3\2\2\2:\u010e\3\2\2\2<\u0115")
        buf.write("\3\2\2\2>\u011d\3\2\2\2@\u011f\3\2\2\2B\u012c\3\2\2\2")
        buf.write("DG\5\4\3\2EG\5\f\7\2FD\3\2\2\2FE\3\2\2\2GH\3\2\2\2HF\3")
        buf.write("\2\2\2HI\3\2\2\2IJ\3\2\2\2JK\7\2\2\3K\3\3\2\2\2LM\5\6")
        buf.write("\4\2MN\5\b\5\2NO\7-\2\2O\5\3\2\2\2PQ\t\2\2\2Q\7\3\2\2")
        buf.write("\2RW\5\n\6\2ST\7,\2\2TV\5\b\5\2US\3\2\2\2VY\3\2\2\2WU")
        buf.write("\3\2\2\2WX\3\2\2\2X\t\3\2\2\2YW\3\2\2\2Z^\7\26\2\2[\\")
        buf.write("\7*\2\2\\]\7\3\2\2]_\7+\2\2^[\3\2\2\2^_\3\2\2\2_\13\3")
        buf.write("\2\2\2`a\5\16\b\2ab\7\26\2\2bd\7&\2\2ce\5\22\n\2dc\3\2")
        buf.write("\2\2de\3\2\2\2ef\3\2\2\2fg\7\'\2\2gh\5\30\r\2h\r\3\2\2")
        buf.write("\2im\5\6\4\2jm\5\20\t\2km\7\13\2\2li\3\2\2\2lj\3\2\2\2")
        buf.write("lk\3\2\2\2m\17\3\2\2\2no\5\6\4\2op\7*\2\2pq\7+\2\2q\21")
        buf.write("\3\2\2\2rw\5\24\13\2st\7,\2\2tv\5\24\13\2us\3\2\2\2vy")
        buf.write("\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\23\3\2\2\2yw\3\2\2\2z{\5")
        buf.write("\6\4\2{|\5\26\f\2|\25\3\2\2\2}\u0080\7\26\2\2~\177\7*")
        buf.write("\2\2\177\u0081\7+\2\2\u0080~\3\2\2\2\u0080\u0081\3\2\2")
        buf.write("\2\u0081\27\3\2\2\2\u0082\u0087\7(\2\2\u0083\u0086\5\4")
        buf.write("\3\2\u0084\u0086\5\32\16\2\u0085\u0083\3\2\2\2\u0085\u0084")
        buf.write("\3\2\2\2\u0086\u0089\3\2\2\2\u0087\u0085\3\2\2\2\u0087")
        buf.write("\u0088\3\2\2\2\u0088\u008a\3\2\2\2\u0089\u0087\3\2\2\2")
        buf.write("\u008a\u008b\7)\2\2\u008b\31\3\2\2\2\u008c\u0095\5\30")
        buf.write("\r\2\u008d\u0095\5\34\17\2\u008e\u0095\5\36\20\2\u008f")
        buf.write("\u0095\5 \21\2\u0090\u0095\5\"\22\2\u0091\u0095\5$\23")
        buf.write("\2\u0092\u0095\5&\24\2\u0093\u0095\5(\25\2\u0094\u008c")
        buf.write("\3\2\2\2\u0094\u008d\3\2\2\2\u0094\u008e\3\2\2\2\u0094")
        buf.write("\u008f\3\2\2\2\u0094\u0090\3\2\2\2\u0094\u0091\3\2\2\2")
        buf.write("\u0094\u0092\3\2\2\2\u0094\u0093\3\2\2\2\u0095\33\3\2")
        buf.write("\2\2\u0096\u0097\7\21\2\2\u0097\u0098\7&\2\2\u0098\u0099")
        buf.write("\5*\26\2\u0099\u009a\7\'\2\2\u009a\u009d\5\32\16\2\u009b")
        buf.write("\u009c\7\22\2\2\u009c\u009e\5\32\16\2\u009d\u009b\3\2")
        buf.write("\2\2\u009d\u009e\3\2\2\2\u009e\35\3\2\2\2\u009f\u00a1")
        buf.write("\7\f\2\2\u00a0\u00a2\5\32\16\2\u00a1\u00a0\3\2\2\2\u00a2")
        buf.write("\u00a3\3\2\2\2\u00a3\u00a1\3\2\2\2\u00a3\u00a4\3\2\2\2")
        buf.write("\u00a4\u00a5\3\2\2\2\u00a5\u00a6\7\r\2\2\u00a6\u00a7\5")
        buf.write("*\26\2\u00a7\u00a8\7-\2\2\u00a8\37\3\2\2\2\u00a9\u00aa")
        buf.write("\7\16\2\2\u00aa\u00ab\7&\2\2\u00ab\u00ac\5*\26\2\u00ac")
        buf.write("\u00ad\7-\2\2\u00ad\u00ae\5*\26\2\u00ae\u00af\7-\2\2\u00af")
        buf.write("\u00b0\5*\26\2\u00b0\u00b1\7\'\2\2\u00b1\u00b2\5\32\16")
        buf.write("\2\u00b2!\3\2\2\2\u00b3\u00b4\7\17\2\2\u00b4\u00b5\7-")
        buf.write("\2\2\u00b5#\3\2\2\2\u00b6\u00b7\7\20\2\2\u00b7\u00b8\7")
        buf.write("-\2\2\u00b8%\3\2\2\2\u00b9\u00bb\7\23\2\2\u00ba\u00bc")
        buf.write("\5*\26\2\u00bb\u00ba\3\2\2\2\u00bb\u00bc\3\2\2\2\u00bc")
        buf.write("\u00bd\3\2\2\2\u00bd\u00be\7-\2\2\u00be\'\3\2\2\2\u00bf")
        buf.write("\u00c0\5*\26\2\u00c0\u00c1\7-\2\2\u00c1)\3\2\2\2\u00c2")
        buf.write("\u00c3\5,\27\2\u00c3\u00c4\7%\2\2\u00c4\u00c5\5*\26\2")
        buf.write("\u00c5\u00c8\3\2\2\2\u00c6\u00c8\5,\27\2\u00c7\u00c2\3")
        buf.write("\2\2\2\u00c7\u00c6\3\2\2\2\u00c8+\3\2\2\2\u00c9\u00ca")
        buf.write("\b\27\1\2\u00ca\u00cb\5.\30\2\u00cb\u00d1\3\2\2\2\u00cc")
        buf.write("\u00cd\f\4\2\2\u00cd\u00ce\7\35\2\2\u00ce\u00d0\5.\30")
        buf.write("\2\u00cf\u00cc\3\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf")
        buf.write("\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2-\3\2\2\2\u00d3\u00d1")
        buf.write("\3\2\2\2\u00d4\u00d5\b\30\1\2\u00d5\u00d6\5\60\31\2\u00d6")
        buf.write("\u00dc\3\2\2\2\u00d7\u00d8\f\4\2\2\u00d8\u00d9\7\36\2")
        buf.write("\2\u00d9\u00db\5\60\31\2\u00da\u00d7\3\2\2\2\u00db\u00de")
        buf.write("\3\2\2\2\u00dc\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd")
        buf.write("/\3\2\2\2\u00de\u00dc\3\2\2\2\u00df\u00e0\5\62\32\2\u00e0")
        buf.write("\u00e1\t\3\2\2\u00e1\u00e2\5\62\32\2\u00e2\u00e5\3\2\2")
        buf.write("\2\u00e3\u00e5\5\62\32\2\u00e4\u00df\3\2\2\2\u00e4\u00e3")
        buf.write("\3\2\2\2\u00e5\61\3\2\2\2\u00e6\u00e7\5\64\33\2\u00e7")
        buf.write("\u00e8\t\4\2\2\u00e8\u00e9\5\64\33\2\u00e9\u00ec\3\2\2")
        buf.write("\2\u00ea\u00ec\5\64\33\2\u00eb\u00e6\3\2\2\2\u00eb\u00ea")
        buf.write("\3\2\2\2\u00ec\63\3\2\2\2\u00ed\u00ee\b\33\1\2\u00ee\u00ef")
        buf.write("\5\66\34\2\u00ef\u00f5\3\2\2\2\u00f0\u00f1\f\4\2\2\u00f1")
        buf.write("\u00f2\t\5\2\2\u00f2\u00f4\5\66\34\2\u00f3\u00f0\3\2\2")
        buf.write("\2\u00f4\u00f7\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6")
        buf.write("\3\2\2\2\u00f6\65\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f8\u00f9")
        buf.write("\b\34\1\2\u00f9\u00fa\58\35\2\u00fa\u0100\3\2\2\2\u00fb")
        buf.write("\u00fc\f\4\2\2\u00fc\u00fd\t\6\2\2\u00fd\u00ff\58\35\2")
        buf.write("\u00fe\u00fb\3\2\2\2\u00ff\u0102\3\2\2\2\u0100\u00fe\3")
        buf.write("\2\2\2\u0100\u0101\3\2\2\2\u0101\67\3\2\2\2\u0102\u0100")
        buf.write("\3\2\2\2\u0103\u0104\t\7\2\2\u0104\u0107\58\35\2\u0105")
        buf.write("\u0107\5:\36\2\u0106\u0103\3\2\2\2\u0106\u0105\3\2\2\2")
        buf.write("\u01079\3\2\2\2\u0108\u0109\5<\37\2\u0109\u010a\7*\2\2")
        buf.write("\u010a\u010b\5*\26\2\u010b\u010c\7+\2\2\u010c\u010f\3")
        buf.write("\2\2\2\u010d\u010f\5<\37\2\u010e\u0108\3\2\2\2\u010e\u010d")
        buf.write("\3\2\2\2\u010f;\3\2\2\2\u0110\u0111\7&\2\2\u0111\u0112")
        buf.write("\5*\26\2\u0112\u0113\7\'\2\2\u0113\u0116\3\2\2\2\u0114")
        buf.write("\u0116\5> \2\u0115\u0110\3\2\2\2\u0115\u0114\3\2\2\2\u0116")
        buf.write("=\3\2\2\2\u0117\u011e\7\3\2\2\u0118\u011e\7\5\2\2\u0119")
        buf.write("\u011e\7\26\2\2\u011a\u011e\7\4\2\2\u011b\u011e\7\6\2")
        buf.write("\2\u011c\u011e\5@!\2\u011d\u0117\3\2\2\2\u011d\u0118\3")
        buf.write("\2\2\2\u011d\u0119\3\2\2\2\u011d\u011a\3\2\2\2\u011d\u011b")
        buf.write("\3\2\2\2\u011d\u011c\3\2\2\2\u011e?\3\2\2\2\u011f\u0120")
        buf.write("\7\26\2\2\u0120\u0121\7&\2\2\u0121\u0122\5B\"\2\u0122")
        buf.write("\u0123\7\'\2\2\u0123A\3\2\2\2\u0124\u0129\5*\26\2\u0125")
        buf.write("\u0126\7,\2\2\u0126\u0128\5*\26\2\u0127\u0125\3\2\2\2")
        buf.write("\u0128\u012b\3\2\2\2\u0129\u0127\3\2\2\2\u0129\u012a\3")
        buf.write("\2\2\2\u012a\u012d\3\2\2\2\u012b\u0129\3\2\2\2\u012c\u0124")
        buf.write("\3\2\2\2\u012c\u012d\3\2\2\2\u012dC\3\2\2\2\35FHW^dlw")
        buf.write("\u0080\u0085\u0087\u0094\u009d\u00a3\u00bb\u00c7\u00d1")
        buf.write("\u00dc\u00e4\u00eb\u00f5\u0100\u0106\u010e\u0115\u011d")
        buf.write("\u0129\u012c")
        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>", "'boolean'", "'int'", "'float'", "'string'", 
                     "'void'", "'do'", "'while'", "'for'", "'break'", "'continue'", 
                     "'if'", "'else'", "'return'", "'true'", "'false'", 
                     "<INVALID>", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", 
                     "'||'", "'&&'", "'=='", "'!='", "'<'", "'>'", "'<='", 
                     "'>='", "'='", "'('", "')'", "'{'", "'}'", "'['", "']'", 
                     "','", "';'" ]

    symbolicNames = [ "<INVALID>", "INTLIT", "FLOATLIT", "BOOLEANLIT", "STRINGLIT", 
                      "BOOLEANTYPE", "INTTYPE", "FLOATTYPE", "STRINGTYPE", 
                      "VOIDTYPE", "DO", "WHILE", "FOR", "BREAK", "CONTINUE", 
                      "IF", "ELSE", "RETURN", "TRUE", "FALSE", "ID", "ADD", 
                      "SUB", "MUL", "DIV", "MOD", "NOT", "OR", "AND", "EQ", 
                      "NE", "LT", "GT", "LE", "GE", "ASSIGN", "LB", "RB", 
                      "LP", "RP", "LSB", "RSB", "COMA", "SEMI", "CMTLINE", 
                      "CMTBLOCK", "WS", "UNCLOSE_STRING", "ILLEGAL_ESCAPE", 
                      "ERROR_CHAR" ]

    RULE_program = 0
    RULE_var_declare = 1
    RULE_prim_type = 2
    RULE_varlist = 3
    RULE_var = 4
    RULE_func_declare = 5
    RULE_func_type = 6
    RULE_arraytype = 7
    RULE_paralist = 8
    RULE_paradcl = 9
    RULE_para = 10
    RULE_blockstmt = 11
    RULE_stmt = 12
    RULE_if_stmt = 13
    RULE_while_stmt = 14
    RULE_for_stmt = 15
    RULE_break_stmt = 16
    RULE_continue_stmt = 17
    RULE_return_stmt = 18
    RULE_expr_stmt = 19
    RULE_expr0 = 20
    RULE_expr1 = 21
    RULE_expr2 = 22
    RULE_expr3 = 23
    RULE_expr4 = 24
    RULE_expr5 = 25
    RULE_expr6 = 26
    RULE_expr7 = 27
    RULE_expr8 = 28
    RULE_expr9 = 29
    RULE_operands = 30
    RULE_calfunc = 31
    RULE_arglist = 32

    ruleNames =  [ "program", "var_declare", "prim_type", "varlist", "var", 
                   "func_declare", "func_type", "arraytype", "paralist", 
                   "paradcl", "para", "blockstmt", "stmt", "if_stmt", "while_stmt", 
                   "for_stmt", "break_stmt", "continue_stmt", "return_stmt", 
                   "expr_stmt", "expr0", "expr1", "expr2", "expr3", "expr4", 
                   "expr5", "expr6", "expr7", "expr8", "expr9", "operands", 
                   "calfunc", "arglist" ]

    EOF = Token.EOF
    INTLIT=1
    FLOATLIT=2
    BOOLEANLIT=3
    STRINGLIT=4
    BOOLEANTYPE=5
    INTTYPE=6
    FLOATTYPE=7
    STRINGTYPE=8
    VOIDTYPE=9
    DO=10
    WHILE=11
    FOR=12
    BREAK=13
    CONTINUE=14
    IF=15
    ELSE=16
    RETURN=17
    TRUE=18
    FALSE=19
    ID=20
    ADD=21
    SUB=22
    MUL=23
    DIV=24
    MOD=25
    NOT=26
    OR=27
    AND=28
    EQ=29
    NE=30
    LT=31
    GT=32
    LE=33
    GE=34
    ASSIGN=35
    LB=36
    RB=37
    LP=38
    RP=39
    LSB=40
    RSB=41
    COMA=42
    SEMI=43
    CMTLINE=44
    CMTBLOCK=45
    WS=46
    UNCLOSE_STRING=47
    ILLEGAL_ESCAPE=48
    ERROR_CHAR=49

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.7.1")
        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 EOF(self):
            return self.getToken(MCParser.EOF, 0)

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


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


        def getRuleIndex(self):
            return MCParser.RULE_program




    def program(self):

        localctx = MCParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 68 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 68
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
                if la_ == 1:
                    self.state = 66
                    self.var_declare()
                    pass

                elif la_ == 2:
                    self.state = 67
                    self.func_declare()
                    pass


                self.state = 70 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE) | (1 << MCParser.VOIDTYPE))) != 0)):
                    break

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

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def varlist(self):
            return self.getTypedRuleContext(MCParser.VarlistContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_var_declare




    def var_declare(self):

        localctx = MCParser.Var_declareContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_var_declare)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 74
            self.prim_type()
            self.state = 75
            self.varlist()
            self.state = 76
            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 Prim_typeContext(ParserRuleContext):

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

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

        def INTTYPE(self):
            return self.getToken(MCParser.INTTYPE, 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_prim_type




    def prim_type(self):

        localctx = MCParser.Prim_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_prim_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (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 VarlistContext(ParserRuleContext):

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

        def var(self):
            return self.getTypedRuleContext(MCParser.VarContext,0)


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

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


        def getRuleIndex(self):
            return MCParser.RULE_varlist




    def varlist(self):

        localctx = MCParser.VarlistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_varlist)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 80
            self.var()
            self.state = 85
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,2,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 81
                    self.match(MCParser.COMA)
                    self.state = 82
                    self.varlist() 
                self.state = 87
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,self._ctx)

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_var




    def var(self):

        localctx = MCParser.VarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_var)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 88
            self.match(MCParser.ID)
            self.state = 92
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==MCParser.LSB:
                self.state = 89
                self.match(MCParser.LSB)
                self.state = 90
                self.match(MCParser.INTLIT)
                self.state = 91
                self.match(MCParser.RSB)


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

    class Func_declareContext(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 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_func_declare




    def func_declare(self):

        localctx = MCParser.Func_declareContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_func_declare)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 94
            self.func_type()
            self.state = 95
            self.match(MCParser.ID)
            self.state = 96
            self.match(MCParser.LB)
            self.state = 98
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE))) != 0):
                self.state = 97
                self.paralist()


            self.state = 100
            self.match(MCParser.RB)
            self.state = 101
            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 Func_typeContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def arraytype(self):
            return self.getTypedRuleContext(MCParser.ArraytypeContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_func_type




    def func_type(self):

        localctx = MCParser.Func_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_func_type)
        try:
            self.state = 106
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 103
                self.prim_type()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 104
                self.arraytype()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 105
                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 ArraytypeContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


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

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

        def getRuleIndex(self):
            return MCParser.RULE_arraytype




    def arraytype(self):

        localctx = MCParser.ArraytypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_arraytype)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 108
            self.prim_type()
            self.state = 109
            self.match(MCParser.LSB)
            self.state = 110
            self.match(MCParser.RSB)
        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 paradcl(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.ParadclContext)
            else:
                return self.getTypedRuleContext(MCParser.ParadclContext,i)


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

        def getRuleIndex(self):
            return MCParser.RULE_paralist




    def paralist(self):

        localctx = MCParser.ParalistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_paralist)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 112
            self.paradcl()
            self.state = 117
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MCParser.COMA:
                self.state = 113
                self.match(MCParser.COMA)
                self.state = 114
                self.paradcl()
                self.state = 119
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class ParadclContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def para(self):
            return self.getTypedRuleContext(MCParser.ParaContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_paradcl




    def paradcl(self):

        localctx = MCParser.ParadclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_paradcl)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.prim_type()
            self.state = 121
            self.para()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ParaContext(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 LSB(self):
            return self.getToken(MCParser.LSB, 0)

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

        def getRuleIndex(self):
            return MCParser.RULE_para




    def para(self):

        localctx = MCParser.ParaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_para)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.match(MCParser.ID)
            self.state = 126
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==MCParser.LSB:
                self.state = 124
                self.match(MCParser.LSB)
                self.state = 125
                self.match(MCParser.RSB)


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


        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_blockstmt




    def blockstmt(self):

        localctx = MCParser.BlockstmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_blockstmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 128
            self.match(MCParser.LP)
            self.state = 133
            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.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE) | (1 << MCParser.DO) | (1 << MCParser.FOR) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.IF) | (1 << MCParser.RETURN) | (1 << MCParser.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0):
                self.state = 131
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [MCParser.BOOLEANTYPE, MCParser.INTTYPE, MCParser.FLOATTYPE, MCParser.STRINGTYPE]:
                    self.state = 129
                    self.var_declare()
                    pass
                elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.DO, MCParser.FOR, MCParser.BREAK, MCParser.CONTINUE, MCParser.IF, MCParser.RETURN, MCParser.ID, MCParser.SUB, MCParser.NOT, MCParser.LB, MCParser.LP]:
                    self.state = 130
                    self.stmt()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 135
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

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

        def blockstmt(self):
            return self.getTypedRuleContext(MCParser.BlockstmtContext,0)


        def if_stmt(self):
            return self.getTypedRuleContext(MCParser.If_stmtContext,0)


        def while_stmt(self):
            return self.getTypedRuleContext(MCParser.While_stmtContext,0)


        def for_stmt(self):
            return self.getTypedRuleContext(MCParser.For_stmtContext,0)


        def break_stmt(self):
            return self.getTypedRuleContext(MCParser.Break_stmtContext,0)


        def continue_stmt(self):
            return self.getTypedRuleContext(MCParser.Continue_stmtContext,0)


        def return_stmt(self):
            return self.getTypedRuleContext(MCParser.Return_stmtContext,0)


        def expr_stmt(self):
            return self.getTypedRuleContext(MCParser.Expr_stmtContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_stmt




    def stmt(self):

        localctx = MCParser.StmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_stmt)
        try:
            self.state = 146
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LP]:
                self.enterOuterAlt(localctx, 1)
                self.state = 138
                self.blockstmt()
                pass
            elif token in [MCParser.IF]:
                self.enterOuterAlt(localctx, 2)
                self.state = 139
                self.if_stmt()
                pass
            elif token in [MCParser.DO]:
                self.enterOuterAlt(localctx, 3)
                self.state = 140
                self.while_stmt()
                pass
            elif token in [MCParser.FOR]:
                self.enterOuterAlt(localctx, 4)
                self.state = 141
                self.for_stmt()
                pass
            elif token in [MCParser.BREAK]:
                self.enterOuterAlt(localctx, 5)
                self.state = 142
                self.break_stmt()
                pass
            elif token in [MCParser.CONTINUE]:
                self.enterOuterAlt(localctx, 6)
                self.state = 143
                self.continue_stmt()
                pass
            elif token in [MCParser.RETURN]:
                self.enterOuterAlt(localctx, 7)
                self.state = 144
                self.return_stmt()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID, MCParser.SUB, MCParser.NOT, MCParser.LB]:
                self.enterOuterAlt(localctx, 8)
                self.state = 145
                self.expr_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 If_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,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_if_stmt




    def if_stmt(self):

        localctx = MCParser.If_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_if_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 148
            self.match(MCParser.IF)
            self.state = 149
            self.match(MCParser.LB)
            self.state = 150
            self.expr0()
            self.state = 151
            self.match(MCParser.RB)
            self.state = 152
            self.stmt()
            self.state = 155
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 153
                self.match(MCParser.ELSE)
                self.state = 154
                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 While_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,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_while_stmt




    def while_stmt(self):

        localctx = MCParser.While_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_while_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self.match(MCParser.DO)
            self.state = 159 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 158
                self.stmt()
                self.state = 161 
                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.DO) | (1 << MCParser.FOR) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.IF) | (1 << MCParser.RETURN) | (1 << MCParser.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0)):
                    break

            self.state = 163
            self.match(MCParser.WHILE)
            self.state = 164
            self.expr0()
            self.state = 165
            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_stmtContext(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 expr0(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Expr0Context)
            else:
                return self.getTypedRuleContext(MCParser.Expr0Context,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_for_stmt




    def for_stmt(self):

        localctx = MCParser.For_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_for_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self.match(MCParser.FOR)
            self.state = 168
            self.match(MCParser.LB)
            self.state = 169
            self.expr0()
            self.state = 170
            self.match(MCParser.SEMI)
            self.state = 171
            self.expr0()
            self.state = 172
            self.match(MCParser.SEMI)
            self.state = 173
            self.expr0()
            self.state = 174
            self.match(MCParser.RB)
            self.state = 175
            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 Break_stmtContext(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_break_stmt




    def break_stmt(self):

        localctx = MCParser.Break_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_break_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 177
            self.match(MCParser.BREAK)
            self.state = 178
            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_stmtContext(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_continue_stmt




    def continue_stmt(self):

        localctx = MCParser.Continue_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_continue_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 180
            self.match(MCParser.CONTINUE)
            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 Return_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_return_stmt




    def return_stmt(self):

        localctx = MCParser.Return_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_return_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(MCParser.RETURN)
            self.state = 185
            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.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB))) != 0):
                self.state = 184
                self.expr0()


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

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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr_stmt




    def expr_stmt(self):

        localctx = MCParser.Expr_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_expr_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.expr0()
            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 Expr0Context(ParserRuleContext):

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

        def expr1(self):
            return self.getTypedRuleContext(MCParser.Expr1Context,0)


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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr0




    def expr0(self):

        localctx = MCParser.Expr0Context(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_expr0)
        try:
            self.state = 197
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 192
                self.expr1(0)
                self.state = 193
                self.match(MCParser.ASSIGN)
                self.state = 194
                self.expr0()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 196
                self.expr1(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 Expr1Context(ParserRuleContext):

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

        def expr2(self):
            return self.getTypedRuleContext(MCParser.Expr2Context,0)


        def expr1(self):
            return self.getTypedRuleContext(MCParser.Expr1Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr1



    def expr1(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr1Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 42
        self.enterRecursionRule(localctx, 42, self.RULE_expr1, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 200
            self.expr2(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 207
            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.Expr1Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr1)
                    self.state = 202
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 203
                    self.match(MCParser.OR)
                    self.state = 204
                    self.expr2(0) 
                self.state = 209
                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 Expr2Context(ParserRuleContext):

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

        def expr3(self):
            return self.getTypedRuleContext(MCParser.Expr3Context,0)


        def expr2(self):
            return self.getTypedRuleContext(MCParser.Expr2Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr2



    def expr2(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr2Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 44
        self.enterRecursionRule(localctx, 44, self.RULE_expr2, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 211
            self.expr3()
            self._ctx.stop = self._input.LT(-1)
            self.state = 218
            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.Expr2Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr2)
                    self.state = 213
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 214
                    self.match(MCParser.AND)
                    self.state = 215
                    self.expr3() 
                self.state = 220
                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 Expr3Context(ParserRuleContext):

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

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


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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr3




    def expr3(self):

        localctx = MCParser.Expr3Context(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_expr3)
        self._la = 0 # Token type
        try:
            self.state = 226
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,17,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 221
                self.expr4()
                self.state = 222
                _la = self._input.LA(1)
                if not(_la==MCParser.EQ or _la==MCParser.NE):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 223
                self.expr4()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 225
                self.expr4()
                pass


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

    class Expr4Context(ParserRuleContext):

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

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


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

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr4




    def expr4(self):

        localctx = MCParser.Expr4Context(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_expr4)
        self._la = 0 # Token type
        try:
            self.state = 233
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 228
                self.expr5(0)
                self.state = 229
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.LT) | (1 << MCParser.GT) | (1 << MCParser.LE) | (1 << MCParser.GE))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 230
                self.expr5(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 232
                self.expr5(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 Expr5Context(ParserRuleContext):

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

        def expr6(self):
            return self.getTypedRuleContext(MCParser.Expr6Context,0)


        def expr5(self):
            return self.getTypedRuleContext(MCParser.Expr5Context,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_expr5



    def expr5(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr5Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 50
        self.enterRecursionRule(localctx, 50, self.RULE_expr5, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 236
            self.expr6(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 243
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,19,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.Expr5Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr5)
                    self.state = 238
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 239
                    _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 = 240
                    self.expr6(0) 
                self.state = 245
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,19,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 Expr6Context(ParserRuleContext):

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

        def expr7(self):
            return self.getTypedRuleContext(MCParser.Expr7Context,0)


        def expr6(self):
            return self.getTypedRuleContext(MCParser.Expr6Context,0)


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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr6



    def expr6(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr6Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 52
        self.enterRecursionRule(localctx, 52, self.RULE_expr6, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 247
            self.expr7()
            self._ctx.stop = self._input.LT(-1)
            self.state = 254
            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
                    localctx = MCParser.Expr6Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr6)
                    self.state = 249
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 250
                    _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 = 251
                    self.expr7() 
                self.state = 256
                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 Expr7Context(ParserRuleContext):

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

        def expr7(self):
            return self.getTypedRuleContext(MCParser.Expr7Context,0)


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

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

        def expr8(self):
            return self.getTypedRuleContext(MCParser.Expr8Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr7




    def expr7(self):

        localctx = MCParser.Expr7Context(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_expr7)
        self._la = 0 # Token type
        try:
            self.state = 260
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.SUB, MCParser.NOT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 257
                _la = self._input.LA(1)
                if not(_la==MCParser.SUB or _la==MCParser.NOT):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 258
                self.expr7()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID, MCParser.LB]:
                self.enterOuterAlt(localctx, 2)
                self.state = 259
                self.expr8()
                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 Expr8Context(ParserRuleContext):

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

        def expr9(self):
            return self.getTypedRuleContext(MCParser.Expr9Context,0)


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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr8




    def expr8(self):

        localctx = MCParser.Expr8Context(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_expr8)
        try:
            self.state = 268
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 262
                self.expr9()
                self.state = 263
                self.match(MCParser.LSB)
                self.state = 264
                self.expr0()
                self.state = 265
                self.match(MCParser.RSB)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 267
                self.expr9()
                pass


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

    class Expr9Context(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def operands(self):
            return self.getTypedRuleContext(MCParser.OperandsContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr9




    def expr9(self):

        localctx = MCParser.Expr9Context(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_expr9)
        try:
            self.state = 275
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 270
                self.match(MCParser.LB)
                self.state = 271
                self.expr0()
                self.state = 272
                self.match(MCParser.RB)
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID]:
                self.enterOuterAlt(localctx, 2)
                self.state = 274
                self.operands()
                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 OperandsContext(ParserRuleContext):

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

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

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

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

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

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

        def calfunc(self):
            return self.getTypedRuleContext(MCParser.CalfuncContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_operands




    def operands(self):

        localctx = MCParser.OperandsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_operands)
        try:
            self.state = 283
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 277
                self.match(MCParser.INTLIT)
                pass

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

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

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

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

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 282
                self.calfunc()
                pass


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

    class CalfuncContext(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 arglist(self):
            return self.getTypedRuleContext(MCParser.ArglistContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_calfunc




    def calfunc(self):

        localctx = MCParser.CalfuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_calfunc)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 285
            self.match(MCParser.ID)
            self.state = 286
            self.match(MCParser.LB)
            self.state = 287
            self.arglist()
            self.state = 288
            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 ArglistContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return MCParser.RULE_arglist




    def arglist(self):

        localctx = MCParser.ArglistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_arglist)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 298
            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.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB))) != 0):
                self.state = 290
                self.expr0()
                self.state = 295
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==MCParser.COMA:
                    self.state = 291
                    self.match(MCParser.COMA)
                    self.state = 292
                    self.expr0()
                    self.state = 297
                    self._errHandler.sync(self)
                    _la = self._input.LA(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[21] = self.expr1_sempred
        self._predicates[22] = self.expr2_sempred
        self._predicates[25] = self.expr5_sempred
        self._predicates[26] = self.expr6_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 expr1_sempred(self, localctx:Expr1Context, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

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

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

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





<filename>assignment/assignment1/main/mc/parser/.antlr/MCParser.py
# Generated from /home/kraken/ppl-course/assignment/assignment1/main/mc/parser/MC.g4 by ANTLR 4.7.1
# 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\63")
        buf.write("\u012f\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\6\2G\n\2\r\2\16")
        buf.write("\2H\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\5\3\5\3\5\7\5V\n")
        buf.write("\5\f\5\16\5Y\13\5\3\6\3\6\3\6\3\6\5\6_\n\6\3\7\3\7\3\7")
        buf.write("\3\7\5\7e\n\7\3\7\3\7\3\7\3\b\3\b\3\b\5\bm\n\b\3\t\3\t")
        buf.write("\3\t\3\t\3\n\3\n\3\n\7\nv\n\n\f\n\16\ny\13\n\3\13\3\13")
        buf.write("\3\13\3\f\3\f\3\f\5\f\u0081\n\f\3\r\3\r\3\r\7\r\u0086")
        buf.write("\n\r\f\r\16\r\u0089\13\r\3\r\3\r\3\16\3\16\3\16\3\16\3")
        buf.write("\16\3\16\3\16\3\16\5\16\u0095\n\16\3\17\3\17\3\17\3\17")
        buf.write("\3\17\3\17\3\17\5\17\u009e\n\17\3\20\3\20\6\20\u00a2\n")
        buf.write("\20\r\20\16\20\u00a3\3\20\3\20\3\20\3\20\3\21\3\21\3\21")
        buf.write("\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\23")
        buf.write("\3\23\3\23\3\24\3\24\5\24\u00bc\n\24\3\24\3\24\3\25\3")
        buf.write("\25\3\25\3\26\3\26\3\26\3\26\3\26\5\26\u00c8\n\26\3\27")
        buf.write("\3\27\3\27\3\27\3\27\3\27\7\27\u00d0\n\27\f\27\16\27\u00d3")
        buf.write("\13\27\3\30\3\30\3\30\3\30\3\30\3\30\7\30\u00db\n\30\f")
        buf.write("\30\16\30\u00de\13\30\3\31\3\31\3\31\3\31\3\31\5\31\u00e5")
        buf.write("\n\31\3\32\3\32\3\32\3\32\3\32\5\32\u00ec\n\32\3\33\3")
        buf.write("\33\3\33\3\33\3\33\3\33\7\33\u00f4\n\33\f\33\16\33\u00f7")
        buf.write("\13\33\3\34\3\34\3\34\3\34\3\34\3\34\7\34\u00ff\n\34\f")
        buf.write("\34\16\34\u0102\13\34\3\35\3\35\3\35\5\35\u0107\n\35\3")
        buf.write("\36\3\36\3\36\3\36\3\36\3\36\5\36\u010f\n\36\3\37\3\37")
        buf.write("\3\37\3\37\3\37\5\37\u0116\n\37\3 \3 \3 \3 \3 \3 \5 \u011e")
        buf.write("\n \3!\3!\3!\3!\3!\3\"\3\"\3\"\7\"\u0128\n\"\f\"\16\"")
        buf.write("\u012b\13\"\5\"\u012d\n\"\3\"\2\6,.\64\66#\2\4\6\b\n\f")
        buf.write("\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@")
        buf.write("B\2\b\3\2\7\n\3\2\37 \3\2!$\3\2\27\30\3\2\31\33\4\2\30")
        buf.write("\30\34\34\2\u0133\2F\3\2\2\2\4L\3\2\2\2\6P\3\2\2\2\bR")
        buf.write("\3\2\2\2\nZ\3\2\2\2\f`\3\2\2\2\16l\3\2\2\2\20n\3\2\2\2")
        buf.write("\22r\3\2\2\2\24z\3\2\2\2\26}\3\2\2\2\30\u0082\3\2\2\2")
        buf.write("\32\u0094\3\2\2\2\34\u0096\3\2\2\2\36\u009f\3\2\2\2 \u00a9")
        buf.write("\3\2\2\2\"\u00b3\3\2\2\2$\u00b6\3\2\2\2&\u00b9\3\2\2\2")
        buf.write("(\u00bf\3\2\2\2*\u00c7\3\2\2\2,\u00c9\3\2\2\2.\u00d4\3")
        buf.write("\2\2\2\60\u00e4\3\2\2\2\62\u00eb\3\2\2\2\64\u00ed\3\2")
        buf.write("\2\2\66\u00f8\3\2\2\28\u0106\3\2\2\2:\u010e\3\2\2\2<\u0115")
        buf.write("\3\2\2\2>\u011d\3\2\2\2@\u011f\3\2\2\2B\u012c\3\2\2\2")
        buf.write("DG\5\4\3\2EG\5\f\7\2FD\3\2\2\2FE\3\2\2\2GH\3\2\2\2HF\3")
        buf.write("\2\2\2HI\3\2\2\2IJ\3\2\2\2JK\7\2\2\3K\3\3\2\2\2LM\5\6")
        buf.write("\4\2MN\5\b\5\2NO\7-\2\2O\5\3\2\2\2PQ\t\2\2\2Q\7\3\2\2")
        buf.write("\2RW\5\n\6\2ST\7,\2\2TV\5\b\5\2US\3\2\2\2VY\3\2\2\2WU")
        buf.write("\3\2\2\2WX\3\2\2\2X\t\3\2\2\2YW\3\2\2\2Z^\7\26\2\2[\\")
        buf.write("\7*\2\2\\]\7\3\2\2]_\7+\2\2^[\3\2\2\2^_\3\2\2\2_\13\3")
        buf.write("\2\2\2`a\5\16\b\2ab\7\26\2\2bd\7&\2\2ce\5\22\n\2dc\3\2")
        buf.write("\2\2de\3\2\2\2ef\3\2\2\2fg\7\'\2\2gh\5\30\r\2h\r\3\2\2")
        buf.write("\2im\5\6\4\2jm\5\20\t\2km\7\13\2\2li\3\2\2\2lj\3\2\2\2")
        buf.write("lk\3\2\2\2m\17\3\2\2\2no\5\6\4\2op\7*\2\2pq\7+\2\2q\21")
        buf.write("\3\2\2\2rw\5\24\13\2st\7,\2\2tv\5\24\13\2us\3\2\2\2vy")
        buf.write("\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\23\3\2\2\2yw\3\2\2\2z{\5")
        buf.write("\6\4\2{|\5\26\f\2|\25\3\2\2\2}\u0080\7\26\2\2~\177\7*")
        buf.write("\2\2\177\u0081\7+\2\2\u0080~\3\2\2\2\u0080\u0081\3\2\2")
        buf.write("\2\u0081\27\3\2\2\2\u0082\u0087\7(\2\2\u0083\u0086\5\4")
        buf.write("\3\2\u0084\u0086\5\32\16\2\u0085\u0083\3\2\2\2\u0085\u0084")
        buf.write("\3\2\2\2\u0086\u0089\3\2\2\2\u0087\u0085\3\2\2\2\u0087")
        buf.write("\u0088\3\2\2\2\u0088\u008a\3\2\2\2\u0089\u0087\3\2\2\2")
        buf.write("\u008a\u008b\7)\2\2\u008b\31\3\2\2\2\u008c\u0095\5\30")
        buf.write("\r\2\u008d\u0095\5\34\17\2\u008e\u0095\5\36\20\2\u008f")
        buf.write("\u0095\5 \21\2\u0090\u0095\5\"\22\2\u0091\u0095\5$\23")
        buf.write("\2\u0092\u0095\5&\24\2\u0093\u0095\5(\25\2\u0094\u008c")
        buf.write("\3\2\2\2\u0094\u008d\3\2\2\2\u0094\u008e\3\2\2\2\u0094")
        buf.write("\u008f\3\2\2\2\u0094\u0090\3\2\2\2\u0094\u0091\3\2\2\2")
        buf.write("\u0094\u0092\3\2\2\2\u0094\u0093\3\2\2\2\u0095\33\3\2")
        buf.write("\2\2\u0096\u0097\7\21\2\2\u0097\u0098\7&\2\2\u0098\u0099")
        buf.write("\5*\26\2\u0099\u009a\7\'\2\2\u009a\u009d\5\32\16\2\u009b")
        buf.write("\u009c\7\22\2\2\u009c\u009e\5\32\16\2\u009d\u009b\3\2")
        buf.write("\2\2\u009d\u009e\3\2\2\2\u009e\35\3\2\2\2\u009f\u00a1")
        buf.write("\7\f\2\2\u00a0\u00a2\5\32\16\2\u00a1\u00a0\3\2\2\2\u00a2")
        buf.write("\u00a3\3\2\2\2\u00a3\u00a1\3\2\2\2\u00a3\u00a4\3\2\2\2")
        buf.write("\u00a4\u00a5\3\2\2\2\u00a5\u00a6\7\r\2\2\u00a6\u00a7\5")
        buf.write("*\26\2\u00a7\u00a8\7-\2\2\u00a8\37\3\2\2\2\u00a9\u00aa")
        buf.write("\7\16\2\2\u00aa\u00ab\7&\2\2\u00ab\u00ac\5*\26\2\u00ac")
        buf.write("\u00ad\7-\2\2\u00ad\u00ae\5*\26\2\u00ae\u00af\7-\2\2\u00af")
        buf.write("\u00b0\5*\26\2\u00b0\u00b1\7\'\2\2\u00b1\u00b2\5\32\16")
        buf.write("\2\u00b2!\3\2\2\2\u00b3\u00b4\7\17\2\2\u00b4\u00b5\7-")
        buf.write("\2\2\u00b5#\3\2\2\2\u00b6\u00b7\7\20\2\2\u00b7\u00b8\7")
        buf.write("-\2\2\u00b8%\3\2\2\2\u00b9\u00bb\7\23\2\2\u00ba\u00bc")
        buf.write("\5*\26\2\u00bb\u00ba\3\2\2\2\u00bb\u00bc\3\2\2\2\u00bc")
        buf.write("\u00bd\3\2\2\2\u00bd\u00be\7-\2\2\u00be\'\3\2\2\2\u00bf")
        buf.write("\u00c0\5*\26\2\u00c0\u00c1\7-\2\2\u00c1)\3\2\2\2\u00c2")
        buf.write("\u00c3\5,\27\2\u00c3\u00c4\7%\2\2\u00c4\u00c5\5*\26\2")
        buf.write("\u00c5\u00c8\3\2\2\2\u00c6\u00c8\5,\27\2\u00c7\u00c2\3")
        buf.write("\2\2\2\u00c7\u00c6\3\2\2\2\u00c8+\3\2\2\2\u00c9\u00ca")
        buf.write("\b\27\1\2\u00ca\u00cb\5.\30\2\u00cb\u00d1\3\2\2\2\u00cc")
        buf.write("\u00cd\f\4\2\2\u00cd\u00ce\7\35\2\2\u00ce\u00d0\5.\30")
        buf.write("\2\u00cf\u00cc\3\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf")
        buf.write("\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2-\3\2\2\2\u00d3\u00d1")
        buf.write("\3\2\2\2\u00d4\u00d5\b\30\1\2\u00d5\u00d6\5\60\31\2\u00d6")
        buf.write("\u00dc\3\2\2\2\u00d7\u00d8\f\4\2\2\u00d8\u00d9\7\36\2")
        buf.write("\2\u00d9\u00db\5\60\31\2\u00da\u00d7\3\2\2\2\u00db\u00de")
        buf.write("\3\2\2\2\u00dc\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd")
        buf.write("/\3\2\2\2\u00de\u00dc\3\2\2\2\u00df\u00e0\5\62\32\2\u00e0")
        buf.write("\u00e1\t\3\2\2\u00e1\u00e2\5\62\32\2\u00e2\u00e5\3\2\2")
        buf.write("\2\u00e3\u00e5\5\62\32\2\u00e4\u00df\3\2\2\2\u00e4\u00e3")
        buf.write("\3\2\2\2\u00e5\61\3\2\2\2\u00e6\u00e7\5\64\33\2\u00e7")
        buf.write("\u00e8\t\4\2\2\u00e8\u00e9\5\64\33\2\u00e9\u00ec\3\2\2")
        buf.write("\2\u00ea\u00ec\5\64\33\2\u00eb\u00e6\3\2\2\2\u00eb\u00ea")
        buf.write("\3\2\2\2\u00ec\63\3\2\2\2\u00ed\u00ee\b\33\1\2\u00ee\u00ef")
        buf.write("\5\66\34\2\u00ef\u00f5\3\2\2\2\u00f0\u00f1\f\4\2\2\u00f1")
        buf.write("\u00f2\t\5\2\2\u00f2\u00f4\5\66\34\2\u00f3\u00f0\3\2\2")
        buf.write("\2\u00f4\u00f7\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6")
        buf.write("\3\2\2\2\u00f6\65\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f8\u00f9")
        buf.write("\b\34\1\2\u00f9\u00fa\58\35\2\u00fa\u0100\3\2\2\2\u00fb")
        buf.write("\u00fc\f\4\2\2\u00fc\u00fd\t\6\2\2\u00fd\u00ff\58\35\2")
        buf.write("\u00fe\u00fb\3\2\2\2\u00ff\u0102\3\2\2\2\u0100\u00fe\3")
        buf.write("\2\2\2\u0100\u0101\3\2\2\2\u0101\67\3\2\2\2\u0102\u0100")
        buf.write("\3\2\2\2\u0103\u0104\t\7\2\2\u0104\u0107\58\35\2\u0105")
        buf.write("\u0107\5:\36\2\u0106\u0103\3\2\2\2\u0106\u0105\3\2\2\2")
        buf.write("\u01079\3\2\2\2\u0108\u0109\5<\37\2\u0109\u010a\7*\2\2")
        buf.write("\u010a\u010b\5*\26\2\u010b\u010c\7+\2\2\u010c\u010f\3")
        buf.write("\2\2\2\u010d\u010f\5<\37\2\u010e\u0108\3\2\2\2\u010e\u010d")
        buf.write("\3\2\2\2\u010f;\3\2\2\2\u0110\u0111\7&\2\2\u0111\u0112")
        buf.write("\5*\26\2\u0112\u0113\7\'\2\2\u0113\u0116\3\2\2\2\u0114")
        buf.write("\u0116\5> \2\u0115\u0110\3\2\2\2\u0115\u0114\3\2\2\2\u0116")
        buf.write("=\3\2\2\2\u0117\u011e\7\3\2\2\u0118\u011e\7\5\2\2\u0119")
        buf.write("\u011e\7\26\2\2\u011a\u011e\7\4\2\2\u011b\u011e\7\6\2")
        buf.write("\2\u011c\u011e\5@!\2\u011d\u0117\3\2\2\2\u011d\u0118\3")
        buf.write("\2\2\2\u011d\u0119\3\2\2\2\u011d\u011a\3\2\2\2\u011d\u011b")
        buf.write("\3\2\2\2\u011d\u011c\3\2\2\2\u011e?\3\2\2\2\u011f\u0120")
        buf.write("\7\26\2\2\u0120\u0121\7&\2\2\u0121\u0122\5B\"\2\u0122")
        buf.write("\u0123\7\'\2\2\u0123A\3\2\2\2\u0124\u0129\5*\26\2\u0125")
        buf.write("\u0126\7,\2\2\u0126\u0128\5*\26\2\u0127\u0125\3\2\2\2")
        buf.write("\u0128\u012b\3\2\2\2\u0129\u0127\3\2\2\2\u0129\u012a\3")
        buf.write("\2\2\2\u012a\u012d\3\2\2\2\u012b\u0129\3\2\2\2\u012c\u0124")
        buf.write("\3\2\2\2\u012c\u012d\3\2\2\2\u012dC\3\2\2\2\35FHW^dlw")
        buf.write("\u0080\u0085\u0087\u0094\u009d\u00a3\u00bb\u00c7\u00d1")
        buf.write("\u00dc\u00e4\u00eb\u00f5\u0100\u0106\u010e\u0115\u011d")
        buf.write("\u0129\u012c")
        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>", "'boolean'", "'int'", "'float'", "'string'", 
                     "'void'", "'do'", "'while'", "'for'", "'break'", "'continue'", 
                     "'if'", "'else'", "'return'", "'true'", "'false'", 
                     "<INVALID>", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", 
                     "'||'", "'&&'", "'=='", "'!='", "'<'", "'>'", "'<='", 
                     "'>='", "'='", "'('", "')'", "'{'", "'}'", "'['", "']'", 
                     "','", "';'" ]

    symbolicNames = [ "<INVALID>", "INTLIT", "FLOATLIT", "BOOLEANLIT", "STRINGLIT", 
                      "BOOLEANTYPE", "INTTYPE", "FLOATTYPE", "STRINGTYPE", 
                      "VOIDTYPE", "DO", "WHILE", "FOR", "BREAK", "CONTINUE", 
                      "IF", "ELSE", "RETURN", "TRUE", "FALSE", "ID", "ADD", 
                      "SUB", "MUL", "DIV", "MOD", "NOT", "OR", "AND", "EQ", 
                      "NE", "LT", "GT", "LE", "GE", "ASSIGN", "LB", "RB", 
                      "LP", "RP", "LSB", "RSB", "COMA", "SEMI", "CMTLINE", 
                      "CMTBLOCK", "WS", "UNCLOSE_STRING", "ILLEGAL_ESCAPE", 
                      "ERROR_CHAR" ]

    RULE_program = 0
    RULE_var_declare = 1
    RULE_prim_type = 2
    RULE_varlist = 3
    RULE_var = 4
    RULE_func_declare = 5
    RULE_func_type = 6
    RULE_arraytype = 7
    RULE_paralist = 8
    RULE_paradcl = 9
    RULE_para = 10
    RULE_blockstmt = 11
    RULE_stmt = 12
    RULE_if_stmt = 13
    RULE_while_stmt = 14
    RULE_for_stmt = 15
    RULE_break_stmt = 16
    RULE_continue_stmt = 17
    RULE_return_stmt = 18
    RULE_expr_stmt = 19
    RULE_expr0 = 20
    RULE_expr1 = 21
    RULE_expr2 = 22
    RULE_expr3 = 23
    RULE_expr4 = 24
    RULE_expr5 = 25
    RULE_expr6 = 26
    RULE_expr7 = 27
    RULE_expr8 = 28
    RULE_expr9 = 29
    RULE_operands = 30
    RULE_calfunc = 31
    RULE_arglist = 32

    ruleNames =  [ "program", "var_declare", "prim_type", "varlist", "var", 
                   "func_declare", "func_type", "arraytype", "paralist", 
                   "paradcl", "para", "blockstmt", "stmt", "if_stmt", "while_stmt", 
                   "for_stmt", "break_stmt", "continue_stmt", "return_stmt", 
                   "expr_stmt", "expr0", "expr1", "expr2", "expr3", "expr4", 
                   "expr5", "expr6", "expr7", "expr8", "expr9", "operands", 
                   "calfunc", "arglist" ]

    EOF = Token.EOF
    INTLIT=1
    FLOATLIT=2
    BOOLEANLIT=3
    STRINGLIT=4
    BOOLEANTYPE=5
    INTTYPE=6
    FLOATTYPE=7
    STRINGTYPE=8
    VOIDTYPE=9
    DO=10
    WHILE=11
    FOR=12
    BREAK=13
    CONTINUE=14
    IF=15
    ELSE=16
    RETURN=17
    TRUE=18
    FALSE=19
    ID=20
    ADD=21
    SUB=22
    MUL=23
    DIV=24
    MOD=25
    NOT=26
    OR=27
    AND=28
    EQ=29
    NE=30
    LT=31
    GT=32
    LE=33
    GE=34
    ASSIGN=35
    LB=36
    RB=37
    LP=38
    RP=39
    LSB=40
    RSB=41
    COMA=42
    SEMI=43
    CMTLINE=44
    CMTBLOCK=45
    WS=46
    UNCLOSE_STRING=47
    ILLEGAL_ESCAPE=48
    ERROR_CHAR=49

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.7.1")
        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 EOF(self):
            return self.getToken(MCParser.EOF, 0)

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


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


        def getRuleIndex(self):
            return MCParser.RULE_program




    def program(self):

        localctx = MCParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 68 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 68
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
                if la_ == 1:
                    self.state = 66
                    self.var_declare()
                    pass

                elif la_ == 2:
                    self.state = 67
                    self.func_declare()
                    pass


                self.state = 70 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE) | (1 << MCParser.VOIDTYPE))) != 0)):
                    break

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

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def varlist(self):
            return self.getTypedRuleContext(MCParser.VarlistContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_var_declare




    def var_declare(self):

        localctx = MCParser.Var_declareContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_var_declare)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 74
            self.prim_type()
            self.state = 75
            self.varlist()
            self.state = 76
            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 Prim_typeContext(ParserRuleContext):

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

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

        def INTTYPE(self):
            return self.getToken(MCParser.INTTYPE, 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_prim_type




    def prim_type(self):

        localctx = MCParser.Prim_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_prim_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (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 VarlistContext(ParserRuleContext):

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

        def var(self):
            return self.getTypedRuleContext(MCParser.VarContext,0)


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

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


        def getRuleIndex(self):
            return MCParser.RULE_varlist




    def varlist(self):

        localctx = MCParser.VarlistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_varlist)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 80
            self.var()
            self.state = 85
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,2,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 81
                    self.match(MCParser.COMA)
                    self.state = 82
                    self.varlist() 
                self.state = 87
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,self._ctx)

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_var




    def var(self):

        localctx = MCParser.VarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_var)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 88
            self.match(MCParser.ID)
            self.state = 92
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==MCParser.LSB:
                self.state = 89
                self.match(MCParser.LSB)
                self.state = 90
                self.match(MCParser.INTLIT)
                self.state = 91
                self.match(MCParser.RSB)


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

    class Func_declareContext(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 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_func_declare




    def func_declare(self):

        localctx = MCParser.Func_declareContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_func_declare)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 94
            self.func_type()
            self.state = 95
            self.match(MCParser.ID)
            self.state = 96
            self.match(MCParser.LB)
            self.state = 98
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE))) != 0):
                self.state = 97
                self.paralist()


            self.state = 100
            self.match(MCParser.RB)
            self.state = 101
            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 Func_typeContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def arraytype(self):
            return self.getTypedRuleContext(MCParser.ArraytypeContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_func_type




    def func_type(self):

        localctx = MCParser.Func_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_func_type)
        try:
            self.state = 106
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 103
                self.prim_type()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 104
                self.arraytype()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 105
                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 ArraytypeContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


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

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

        def getRuleIndex(self):
            return MCParser.RULE_arraytype




    def arraytype(self):

        localctx = MCParser.ArraytypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_arraytype)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 108
            self.prim_type()
            self.state = 109
            self.match(MCParser.LSB)
            self.state = 110
            self.match(MCParser.RSB)
        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 paradcl(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.ParadclContext)
            else:
                return self.getTypedRuleContext(MCParser.ParadclContext,i)


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

        def getRuleIndex(self):
            return MCParser.RULE_paralist




    def paralist(self):

        localctx = MCParser.ParalistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_paralist)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 112
            self.paradcl()
            self.state = 117
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MCParser.COMA:
                self.state = 113
                self.match(MCParser.COMA)
                self.state = 114
                self.paradcl()
                self.state = 119
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class ParadclContext(ParserRuleContext):

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

        def prim_type(self):
            return self.getTypedRuleContext(MCParser.Prim_typeContext,0)


        def para(self):
            return self.getTypedRuleContext(MCParser.ParaContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_paradcl




    def paradcl(self):

        localctx = MCParser.ParadclContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_paradcl)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.prim_type()
            self.state = 121
            self.para()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ParaContext(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 LSB(self):
            return self.getToken(MCParser.LSB, 0)

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

        def getRuleIndex(self):
            return MCParser.RULE_para




    def para(self):

        localctx = MCParser.ParaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_para)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.match(MCParser.ID)
            self.state = 126
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==MCParser.LSB:
                self.state = 124
                self.match(MCParser.LSB)
                self.state = 125
                self.match(MCParser.RSB)


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


        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_blockstmt




    def blockstmt(self):

        localctx = MCParser.BlockstmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_blockstmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 128
            self.match(MCParser.LP)
            self.state = 133
            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.BOOLEANTYPE) | (1 << MCParser.INTTYPE) | (1 << MCParser.FLOATTYPE) | (1 << MCParser.STRINGTYPE) | (1 << MCParser.DO) | (1 << MCParser.FOR) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.IF) | (1 << MCParser.RETURN) | (1 << MCParser.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0):
                self.state = 131
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [MCParser.BOOLEANTYPE, MCParser.INTTYPE, MCParser.FLOATTYPE, MCParser.STRINGTYPE]:
                    self.state = 129
                    self.var_declare()
                    pass
                elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.DO, MCParser.FOR, MCParser.BREAK, MCParser.CONTINUE, MCParser.IF, MCParser.RETURN, MCParser.ID, MCParser.SUB, MCParser.NOT, MCParser.LB, MCParser.LP]:
                    self.state = 130
                    self.stmt()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 135
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

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

        def blockstmt(self):
            return self.getTypedRuleContext(MCParser.BlockstmtContext,0)


        def if_stmt(self):
            return self.getTypedRuleContext(MCParser.If_stmtContext,0)


        def while_stmt(self):
            return self.getTypedRuleContext(MCParser.While_stmtContext,0)


        def for_stmt(self):
            return self.getTypedRuleContext(MCParser.For_stmtContext,0)


        def break_stmt(self):
            return self.getTypedRuleContext(MCParser.Break_stmtContext,0)


        def continue_stmt(self):
            return self.getTypedRuleContext(MCParser.Continue_stmtContext,0)


        def return_stmt(self):
            return self.getTypedRuleContext(MCParser.Return_stmtContext,0)


        def expr_stmt(self):
            return self.getTypedRuleContext(MCParser.Expr_stmtContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_stmt




    def stmt(self):

        localctx = MCParser.StmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_stmt)
        try:
            self.state = 146
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LP]:
                self.enterOuterAlt(localctx, 1)
                self.state = 138
                self.blockstmt()
                pass
            elif token in [MCParser.IF]:
                self.enterOuterAlt(localctx, 2)
                self.state = 139
                self.if_stmt()
                pass
            elif token in [MCParser.DO]:
                self.enterOuterAlt(localctx, 3)
                self.state = 140
                self.while_stmt()
                pass
            elif token in [MCParser.FOR]:
                self.enterOuterAlt(localctx, 4)
                self.state = 141
                self.for_stmt()
                pass
            elif token in [MCParser.BREAK]:
                self.enterOuterAlt(localctx, 5)
                self.state = 142
                self.break_stmt()
                pass
            elif token in [MCParser.CONTINUE]:
                self.enterOuterAlt(localctx, 6)
                self.state = 143
                self.continue_stmt()
                pass
            elif token in [MCParser.RETURN]:
                self.enterOuterAlt(localctx, 7)
                self.state = 144
                self.return_stmt()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID, MCParser.SUB, MCParser.NOT, MCParser.LB]:
                self.enterOuterAlt(localctx, 8)
                self.state = 145
                self.expr_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 If_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,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_if_stmt




    def if_stmt(self):

        localctx = MCParser.If_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_if_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 148
            self.match(MCParser.IF)
            self.state = 149
            self.match(MCParser.LB)
            self.state = 150
            self.expr0()
            self.state = 151
            self.match(MCParser.RB)
            self.state = 152
            self.stmt()
            self.state = 155
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 153
                self.match(MCParser.ELSE)
                self.state = 154
                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 While_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,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_while_stmt




    def while_stmt(self):

        localctx = MCParser.While_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_while_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self.match(MCParser.DO)
            self.state = 159 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 158
                self.stmt()
                self.state = 161 
                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.DO) | (1 << MCParser.FOR) | (1 << MCParser.BREAK) | (1 << MCParser.CONTINUE) | (1 << MCParser.IF) | (1 << MCParser.RETURN) | (1 << MCParser.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB) | (1 << MCParser.LP))) != 0)):
                    break

            self.state = 163
            self.match(MCParser.WHILE)
            self.state = 164
            self.expr0()
            self.state = 165
            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_stmtContext(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 expr0(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(MCParser.Expr0Context)
            else:
                return self.getTypedRuleContext(MCParser.Expr0Context,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_for_stmt




    def for_stmt(self):

        localctx = MCParser.For_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_for_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self.match(MCParser.FOR)
            self.state = 168
            self.match(MCParser.LB)
            self.state = 169
            self.expr0()
            self.state = 170
            self.match(MCParser.SEMI)
            self.state = 171
            self.expr0()
            self.state = 172
            self.match(MCParser.SEMI)
            self.state = 173
            self.expr0()
            self.state = 174
            self.match(MCParser.RB)
            self.state = 175
            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 Break_stmtContext(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_break_stmt




    def break_stmt(self):

        localctx = MCParser.Break_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_break_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 177
            self.match(MCParser.BREAK)
            self.state = 178
            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_stmtContext(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_continue_stmt




    def continue_stmt(self):

        localctx = MCParser.Continue_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_continue_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 180
            self.match(MCParser.CONTINUE)
            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 Return_stmtContext(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_return_stmt




    def return_stmt(self):

        localctx = MCParser.Return_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_return_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(MCParser.RETURN)
            self.state = 185
            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.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB))) != 0):
                self.state = 184
                self.expr0()


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

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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr_stmt




    def expr_stmt(self):

        localctx = MCParser.Expr_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_expr_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.expr0()
            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 Expr0Context(ParserRuleContext):

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

        def expr1(self):
            return self.getTypedRuleContext(MCParser.Expr1Context,0)


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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr0




    def expr0(self):

        localctx = MCParser.Expr0Context(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_expr0)
        try:
            self.state = 197
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 192
                self.expr1(0)
                self.state = 193
                self.match(MCParser.ASSIGN)
                self.state = 194
                self.expr0()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 196
                self.expr1(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 Expr1Context(ParserRuleContext):

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

        def expr2(self):
            return self.getTypedRuleContext(MCParser.Expr2Context,0)


        def expr1(self):
            return self.getTypedRuleContext(MCParser.Expr1Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr1



    def expr1(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr1Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 42
        self.enterRecursionRule(localctx, 42, self.RULE_expr1, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 200
            self.expr2(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 207
            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.Expr1Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr1)
                    self.state = 202
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 203
                    self.match(MCParser.OR)
                    self.state = 204
                    self.expr2(0) 
                self.state = 209
                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 Expr2Context(ParserRuleContext):

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

        def expr3(self):
            return self.getTypedRuleContext(MCParser.Expr3Context,0)


        def expr2(self):
            return self.getTypedRuleContext(MCParser.Expr2Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr2



    def expr2(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr2Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 44
        self.enterRecursionRule(localctx, 44, self.RULE_expr2, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 211
            self.expr3()
            self._ctx.stop = self._input.LT(-1)
            self.state = 218
            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.Expr2Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr2)
                    self.state = 213
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 214
                    self.match(MCParser.AND)
                    self.state = 215
                    self.expr3() 
                self.state = 220
                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 Expr3Context(ParserRuleContext):

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

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


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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr3




    def expr3(self):

        localctx = MCParser.Expr3Context(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_expr3)
        self._la = 0 # Token type
        try:
            self.state = 226
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,17,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 221
                self.expr4()
                self.state = 222
                _la = self._input.LA(1)
                if not(_la==MCParser.EQ or _la==MCParser.NE):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 223
                self.expr4()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 225
                self.expr4()
                pass


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

    class Expr4Context(ParserRuleContext):

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

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


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

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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr4




    def expr4(self):

        localctx = MCParser.Expr4Context(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_expr4)
        self._la = 0 # Token type
        try:
            self.state = 233
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 228
                self.expr5(0)
                self.state = 229
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MCParser.LT) | (1 << MCParser.GT) | (1 << MCParser.LE) | (1 << MCParser.GE))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 230
                self.expr5(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 232
                self.expr5(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 Expr5Context(ParserRuleContext):

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

        def expr6(self):
            return self.getTypedRuleContext(MCParser.Expr6Context,0)


        def expr5(self):
            return self.getTypedRuleContext(MCParser.Expr5Context,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_expr5



    def expr5(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr5Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 50
        self.enterRecursionRule(localctx, 50, self.RULE_expr5, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 236
            self.expr6(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 243
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,19,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.Expr5Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr5)
                    self.state = 238
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 239
                    _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 = 240
                    self.expr6(0) 
                self.state = 245
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,19,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 Expr6Context(ParserRuleContext):

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

        def expr7(self):
            return self.getTypedRuleContext(MCParser.Expr7Context,0)


        def expr6(self):
            return self.getTypedRuleContext(MCParser.Expr6Context,0)


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

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

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

        def getRuleIndex(self):
            return MCParser.RULE_expr6



    def expr6(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = MCParser.Expr6Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 52
        self.enterRecursionRule(localctx, 52, self.RULE_expr6, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 247
            self.expr7()
            self._ctx.stop = self._input.LT(-1)
            self.state = 254
            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
                    localctx = MCParser.Expr6Context(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr6)
                    self.state = 249
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 250
                    _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 = 251
                    self.expr7() 
                self.state = 256
                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 Expr7Context(ParserRuleContext):

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

        def expr7(self):
            return self.getTypedRuleContext(MCParser.Expr7Context,0)


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

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

        def expr8(self):
            return self.getTypedRuleContext(MCParser.Expr8Context,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr7




    def expr7(self):

        localctx = MCParser.Expr7Context(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_expr7)
        self._la = 0 # Token type
        try:
            self.state = 260
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.SUB, MCParser.NOT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 257
                _la = self._input.LA(1)
                if not(_la==MCParser.SUB or _la==MCParser.NOT):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 258
                self.expr7()
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID, MCParser.LB]:
                self.enterOuterAlt(localctx, 2)
                self.state = 259
                self.expr8()
                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 Expr8Context(ParserRuleContext):

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

        def expr9(self):
            return self.getTypedRuleContext(MCParser.Expr9Context,0)


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

        def expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_expr8




    def expr8(self):

        localctx = MCParser.Expr8Context(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_expr8)
        try:
            self.state = 268
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 262
                self.expr9()
                self.state = 263
                self.match(MCParser.LSB)
                self.state = 264
                self.expr0()
                self.state = 265
                self.match(MCParser.RSB)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 267
                self.expr9()
                pass


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

    class Expr9Context(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 expr0(self):
            return self.getTypedRuleContext(MCParser.Expr0Context,0)


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

        def operands(self):
            return self.getTypedRuleContext(MCParser.OperandsContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_expr9




    def expr9(self):

        localctx = MCParser.Expr9Context(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_expr9)
        try:
            self.state = 275
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MCParser.LB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 270
                self.match(MCParser.LB)
                self.state = 271
                self.expr0()
                self.state = 272
                self.match(MCParser.RB)
                pass
            elif token in [MCParser.INTLIT, MCParser.FLOATLIT, MCParser.BOOLEANLIT, MCParser.STRINGLIT, MCParser.ID]:
                self.enterOuterAlt(localctx, 2)
                self.state = 274
                self.operands()
                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 OperandsContext(ParserRuleContext):

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

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

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

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

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

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

        def calfunc(self):
            return self.getTypedRuleContext(MCParser.CalfuncContext,0)


        def getRuleIndex(self):
            return MCParser.RULE_operands




    def operands(self):

        localctx = MCParser.OperandsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_operands)
        try:
            self.state = 283
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 277
                self.match(MCParser.INTLIT)
                pass

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

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

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

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

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 282
                self.calfunc()
                pass


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

    class CalfuncContext(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 arglist(self):
            return self.getTypedRuleContext(MCParser.ArglistContext,0)


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

        def getRuleIndex(self):
            return MCParser.RULE_calfunc




    def calfunc(self):

        localctx = MCParser.CalfuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_calfunc)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 285
            self.match(MCParser.ID)
            self.state = 286
            self.match(MCParser.LB)
            self.state = 287
            self.arglist()
            self.state = 288
            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 ArglistContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return MCParser.RULE_arglist




    def arglist(self):

        localctx = MCParser.ArglistContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_arglist)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 298
            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.ID) | (1 << MCParser.SUB) | (1 << MCParser.NOT) | (1 << MCParser.LB))) != 0):
                self.state = 290
                self.expr0()
                self.state = 295
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==MCParser.COMA:
                    self.state = 291
                    self.match(MCParser.COMA)
                    self.state = 292
                    self.expr0()
                    self.state = 297
                    self._errHandler.sync(self)
                    _la = self._input.LA(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[21] = self.expr1_sempred
        self._predicates[22] = self.expr2_sempred
        self._predicates[25] = self.expr5_sempred
        self._predicates[26] = self.expr6_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 expr1_sempred(self, localctx:Expr1Context, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

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

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

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





# Generated from /home/kraken/ppl-course/assignment/assignment1/main/mc/parser/MC.g4 by ANTLR 4.7.1 # encoding: utf-8 #\2\4\6\b\n\f") #\3\2\2\2\u00b6\u00b7\7\20\2\2\u00b7\u00b8\7") # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type