# Generated from PLambda.g4 by ANTLR 4.8
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3D")
        buf.write("\u00d0\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\3\2\6\2\30\n\2\r\2")
        buf.write("\16\2\31\3\3\3\3\3\3\6\3\37\n\3\r\3\16\3 \3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\6\3)\n\3\r\3\16\3*\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\5\3\63\n\3\3\3\6\3\66\n\3\r\3\16\3\67\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\6\3@\n\3\r\3\16\3A\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\7\3K\n\3\f\3\16\3N\13\3\3\3\3\3\3\3\3\3\3\3\3\3\7")
        buf.write("\3V\n\3\f\3\16\3Y\13\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3x\n\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\5\3\u0081\n\3\3\3\3\3\3\3\3\3\3\3\7\3\u0088")
        buf.write("\n\3\f\3\16\3\u008b\13\3\3\3\3\3\3\3\3\3\6\3\u0091\n\3")
        buf.write("\r\3\16\3\u0092\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\6\3\u009d")
        buf.write("\n\3\r\3\16\3\u009e\3\3\3\3\3\3\3\3\3\3\5\3\u00a6\n\3")
        buf.write("\3\4\3\4\7\4\u00aa\n\4\f\4\16\4\u00ad\13\4\3\4\3\4\3\5")
        buf.write("\3\5\3\6\3\6\6\6\u00b5\n\6\r\6\16\6\u00b6\3\6\3\6\3\7")
        buf.write("\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\6\b\u00c4\n\b\r\b\16")
        buf.write("\b\u00c5\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\13\2\2\f")
        buf.write("\2\4\6\b\n\f\16\20\22\24\2\4\3\2<=\4\2\5\5<<\2\u00e6\2")
        buf.write("\27\3\2\2\2\4\u00a5\3\2\2\2\6\u00a7\3\2\2\2\b\u00b0\3")
        buf.write("\2\2\2\n\u00b2\3\2\2\2\f\u00ba\3\2\2\2\16\u00bf\3\2\2")
        buf.write("\2\20\u00c9\3\2\2\2\22\u00cb\3\2\2\2\24\u00cd\3\2\2\2")
        buf.write("\26\30\5\4\3\2\27\26\3\2\2\2\30\31\3\2\2\2\31\27\3\2\2")
        buf.write("\2\31\32\3\2\2\2\32\3\3\2\2\2\33\34\7\3\2\2\34\36\7\16")
        buf.write("\2\2\35\37\5\4\3\2\36\35\3\2\2\2\37 \3\2\2\2 \36\3\2\2")
        buf.write("\2 !\3\2\2\2!\"\3\2\2\2\"#\7\4\2\2#\u00a6\3\2\2\2$%\7")
        buf.write("\3\2\2%&\7\20\2\2&(\5\n\6\2\')\5\4\3\2(\'\3\2\2\2)*\3")
        buf.write("\2\2\2*(\3\2\2\2*+\3\2\2\2+,\3\2\2\2,-\7\4\2\2-\u00a6")
        buf.write("\3\2\2\2./\7\3\2\2/\60\7\21\2\2\60\62\7<\2\2\61\63\5\6")
        buf.write("\4\2\62\61\3\2\2\2\62\63\3\2\2\2\63\65\3\2\2\2\64\66\5")
        buf.write("\4\3\2\65\64\3\2\2\2\66\67\3\2\2\2\67\65\3\2\2\2\678\3")
        buf.write("\2\2\289\3\2\2\29:\7\4\2\2:\u00a6\3\2\2\2;<\7\3\2\2<=")
        buf.write("\7\22\2\2=?\5\6\4\2>@\5\4\3\2?>\3\2\2\2@A\3\2\2\2A?\3")
        buf.write("\2\2\2AB\3\2\2\2BC\3\2\2\2CD\7\4\2\2D\u00a6\3\2\2\2EF")
        buf.write("\7\3\2\2FG\7\24\2\2GH\5\4\3\2HL\5\4\3\2IK\5\4\3\2JI\3")
        buf.write("\2\2\2KN\3\2\2\2LJ\3\2\2\2LM\3\2\2\2MO\3\2\2\2NL\3\2\2")
        buf.write("\2OP\7\4\2\2P\u00a6\3\2\2\2QR\7\3\2\2RS\7\23\2\2SW\5\4")
        buf.write("\3\2TV\5\4\3\2UT\3\2\2\2VY\3\2\2\2WU\3\2\2\2WX\3\2\2\2")
        buf.write("XZ\3\2\2\2YW\3\2\2\2Z[\7\4\2\2[\u00a6\3\2\2\2\\]\7\3\2")
        buf.write("\2]^\7\6\2\2^_\5\22\n\2_`\7\4\2\2`\u00a6\3\2\2\2ab\7\3")
        buf.write("\2\2bc\7\7\2\2cd\5\4\3\2de\7\4\2\2e\u00a6\3\2\2\2fg\7")
        buf.write("\3\2\2gh\7\b\2\2hi\5\4\3\2ij\5\4\3\2jk\7\4\2\2k\u00a6")
        buf.write("\3\2\2\2lm\7\3\2\2mn\7\t\2\2no\5\4\3\2op\5\4\3\2pq\5\4")
        buf.write("\3\2qr\7\4\2\2r\u00a6\3\2\2\2st\7\3\2\2tu\7\13\2\2uw\5")
        buf.write("\4\3\2vx\5\4\3\2wv\3\2\2\2wx\3\2\2\2xy\3\2\2\2yz\7\4\2")
        buf.write("\2z\u00a6\3\2\2\2{|\7\3\2\2|}\7\f\2\2}~\5\4\3\2~\u0080")
        buf.write("\5\4\3\2\177\u0081\5\4\3\2\u0080\177\3\2\2\2\u0080\u0081")
        buf.write("\3\2\2\2\u0081\u0082\3\2\2\2\u0082\u0083\7\4\2\2\u0083")
        buf.write("\u00a6\3\2\2\2\u0084\u0085\7\3\2\2\u0085\u0089\7\n\2\2")
        buf.write("\u0086\u0088\5\4\3\2\u0087\u0086\3\2\2\2\u0088\u008b\3")
        buf.write("\2\2\2\u0089\u0087\3\2\2\2\u0089\u008a\3\2\2\2\u008a\u008c")
        buf.write("\3\2\2\2\u008b\u0089\3\2\2\2\u008c\u00a6\7\4\2\2\u008d")
        buf.write("\u008e\7\3\2\2\u008e\u0090\7\27\2\2\u008f\u0091\5\4\3")
        buf.write("\2\u0090\u008f\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0090")
        buf.write("\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u0094\3\2\2\2\u0094")
        buf.write("\u0095\5\16\b\2\u0095\u0096\7\4\2\2\u0096\u00a6\3\2\2")
        buf.write("\2\u0097\u0098\7\3\2\2\u0098\u0099\7\26\2\2\u0099\u009a")
        buf.write("\7<\2\2\u009a\u009c\5\20\t\2\u009b\u009d\5\4\3\2\u009c")
        buf.write("\u009b\3\2\2\2\u009d\u009e\3\2\2\2\u009e\u009c\3\2\2\2")
        buf.write("\u009e\u009f\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a1\7")
        buf.write("\4\2\2\u00a1\u00a6\3\2\2\2\u00a2\u00a6\7\5\2\2\u00a3\u00a6")
        buf.write("\7<\2\2\u00a4\u00a6\7\r\2\2\u00a5\33\3\2\2\2\u00a5$\3")
        buf.write("\2\2\2\u00a5.\3\2\2\2\u00a5;\3\2\2\2\u00a5E\3\2\2\2\u00a5")
        buf.write("Q\3\2\2\2\u00a5\\\3\2\2\2\u00a5a\3\2\2\2\u00a5f\3\2\2")
        buf.write("\2\u00a5l\3\2\2\2\u00a5s\3\2\2\2\u00a5{\3\2\2\2\u00a5")
        buf.write("\u0084\3\2\2\2\u00a5\u008d\3\2\2\2\u00a5\u0097\3\2\2\2")
        buf.write("\u00a5\u00a2\3\2\2\2\u00a5\u00a3\3\2\2\2\u00a5\u00a4\3")
        buf.write("\2\2\2\u00a6\5\3\2\2\2\u00a7\u00ab\7\3\2\2\u00a8\u00aa")
        buf.write("\5\b\5\2\u00a9\u00a8\3\2\2\2\u00aa\u00ad\3\2\2\2\u00ab")
        buf.write("\u00a9\3\2\2\2\u00ab\u00ac\3\2\2\2\u00ac\u00ae\3\2\2\2")
        buf.write("\u00ad\u00ab\3\2\2\2\u00ae\u00af\7\4\2\2\u00af\7\3\2\2")
        buf.write("\2\u00b0\u00b1\7<\2\2\u00b1\t\3\2\2\2\u00b2\u00b4\7\3")
        buf.write("\2\2\u00b3\u00b5\5\f\7\2\u00b4\u00b3\3\2\2\2\u00b5\u00b6")
        buf.write("\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7")
        buf.write("\u00b8\3\2\2\2\u00b8\u00b9\7\4\2\2\u00b9\13\3\2\2\2\u00ba")
        buf.write("\u00bb\7\3\2\2\u00bb\u00bc\5\b\5\2\u00bc\u00bd\5\4\3\2")
        buf.write("\u00bd\u00be\7\4\2\2\u00be\r\3\2\2\2\u00bf\u00c0\7\3\2")
        buf.write("\2\u00c0\u00c1\7\30\2\2\u00c1\u00c3\5\b\5\2\u00c2\u00c4")
        buf.write("\5\4\3\2\u00c3\u00c2\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c5")
        buf.write("\u00c3\3\2\2\2\u00c5\u00c6\3\2\2\2\u00c6\u00c7\3\2\2\2")
        buf.write("\u00c7\u00c8\7\4\2\2\u00c8\17\3\2\2\2\u00c9\u00ca\5\4")
        buf.write("\3\2\u00ca\21\3\2\2\2\u00cb\u00cc\t\2\2\2\u00cc\23\3\2")
        buf.write("\2\2\u00cd\u00ce\t\3\2\2\u00ce\25\3\2\2\2\23\31 *\62\67")
        buf.write("ALWw\u0080\u0089\u0092\u009e\u00a5\u00ab\u00b6\u00c5")
        return buf.getvalue()


class PLambdaParser ( Parser ):

    grammarFileName = "PLambda.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'('", "')'", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'None'", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'-'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "STRING", "PRIMITIVE_DATA_OP", 
                      "UNARY_OP", "BINARY_OP", "TERNARY_OP", "N_ARY_OP", 
                      "AMBI1_OP", "AMBI2_OP", "NONE", "SEQ", "DO", "LET", 
                      "DEFINE", "LAMBDA", "APPLY", "INVOKE", "SINVOKE", 
                      "FOR", "TRY", "CATCH", "BOOLEAN", "FLOAT", "INT", 
                      "LOAD", "IMPORT", "ISNONE", "ISOBJECT", "ISINT", "ISFLOAT", 
                      "GETUID", "GLOBAL", "NOT", "THROW", "FETCH", "NARROW", 
                      "INSTANCEOF", "GET", "IN", "IS", "LOOKUP", "SETUID", 
                      "KWAPPLY", "MODIFY", "UPDATE", "SUPDATE", "SETATTR", 
                      "CONCAT", "AND", "OR", "MKTUPLE", "MKLIST", "MKDICT", 
                      "MINUS", "IF", "GETATTR", "ID", "NUMBER", "STRING_SQ", 
                      "STRING_DQ", "SYMBOL", "LINE_COMMENT", "NEW_LINE_COMMENT", 
                      "NEW_COMMENT", "WHITE_SPACE" ]

    RULE_unit = 0
    RULE_expression = 1
    RULE_parameterList = 2
    RULE_parameter = 3
    RULE_bindingList = 4
    RULE_bindingPair = 5
    RULE_catchExpression = 6
    RULE_rangeExpression = 7
    RULE_data = 8
    RULE_token = 9

    ruleNames =  [ "unit", "expression", "parameterList", "parameter", "bindingList", 
                   "bindingPair", "catchExpression", "rangeExpression", 
                   "data", "token" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    STRING=3
    PRIMITIVE_DATA_OP=4
    UNARY_OP=5
    BINARY_OP=6
    TERNARY_OP=7
    N_ARY_OP=8
    AMBI1_OP=9
    AMBI2_OP=10
    NONE=11
    SEQ=12
    DO=13
    LET=14
    DEFINE=15
    LAMBDA=16
    APPLY=17
    INVOKE=18
    SINVOKE=19
    FOR=20
    TRY=21
    CATCH=22
    BOOLEAN=23
    FLOAT=24
    INT=25
    LOAD=26
    IMPORT=27
    ISNONE=28
    ISOBJECT=29
    ISINT=30
    ISFLOAT=31
    GETUID=32
    GLOBAL=33
    NOT=34
    THROW=35
    FETCH=36
    NARROW=37
    INSTANCEOF=38
    GET=39
    IN=40
    IS=41
    LOOKUP=42
    SETUID=43
    KWAPPLY=44
    MODIFY=45
    UPDATE=46
    SUPDATE=47
    SETATTR=48
    CONCAT=49
    AND=50
    OR=51
    MKTUPLE=52
    MKLIST=53
    MKDICT=54
    MINUS=55
    IF=56
    GETATTR=57
    ID=58
    NUMBER=59
    STRING_SQ=60
    STRING_DQ=61
    SYMBOL=62
    LINE_COMMENT=63
    NEW_LINE_COMMENT=64
    NEW_COMMENT=65
    WHITE_SPACE=66

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




    class UnitContext(ParserRuleContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


        def getRuleIndex(self):
            return PLambdaParser.RULE_unit

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

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

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




    def unit(self):

        localctx = PLambdaParser.UnitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_unit)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 21 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 20
                self.expression()
                self.state = 23 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                    break

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


    class ExpressionContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return PLambdaParser.RULE_expression

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class NaryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def N_ARY_OP(self):
            return self.getToken(PLambdaParser.N_ARY_OP, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class ForExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FOR(self):
            return self.getToken(PLambdaParser.FOR, 0)
        def ID(self):
            return self.getToken(PLambdaParser.ID, 0)
        def rangeExpression(self):
            return self.getTypedRuleContext(PLambdaParser.RangeExpressionContext,0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class LambdaExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LAMBDA(self):
            return self.getToken(PLambdaParser.LAMBDA, 0)
        def parameterList(self):
            return self.getTypedRuleContext(PLambdaParser.ParameterListContext,0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class OneOrMoreExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def AMBI1_OP(self):
            return self.getToken(PLambdaParser.AMBI1_OP, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class NoneLiteralContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def NONE(self):
            return self.getToken(PLambdaParser.NONE, 0)

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

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

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


    class SeqExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def SEQ(self):
            return self.getToken(PLambdaParser.SEQ, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class ApplyExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def APPLY(self):
            return self.getToken(PLambdaParser.APPLY, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class BinaryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def BINARY_OP(self):
            return self.getToken(PLambdaParser.BINARY_OP, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class TwoOrMoreExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def AMBI2_OP(self):
            return self.getToken(PLambdaParser.AMBI2_OP, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class TryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TRY(self):
            return self.getToken(PLambdaParser.TRY, 0)
        def catchExpression(self):
            return self.getTypedRuleContext(PLambdaParser.CatchExpressionContext,0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class StringLiteralContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

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

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

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

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


    class DefineExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def DEFINE(self):
            return self.getToken(PLambdaParser.DEFINE, 0)
        def ID(self):
            return self.getToken(PLambdaParser.ID, 0)
        def parameterList(self):
            return self.getTypedRuleContext(PLambdaParser.ParameterListContext,0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class LetExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LET(self):
            return self.getToken(PLambdaParser.LET, 0)
        def bindingList(self):
            return self.getTypedRuleContext(PLambdaParser.BindingListContext,0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class IdentifierLiteralContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

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

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

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

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


    class UnaryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def UNARY_OP(self):
            return self.getToken(PLambdaParser.UNARY_OP, 0)
        def expression(self):
            return self.getTypedRuleContext(PLambdaParser.ExpressionContext,0)


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

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

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


    class TernaryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TERNARY_OP(self):
            return self.getToken(PLambdaParser.TERNARY_OP, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class InvokeExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INVOKE(self):
            return self.getToken(PLambdaParser.INVOKE, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


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

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

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


    class DataExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PLambdaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PRIMITIVE_DATA_OP(self):
            return self.getToken(PLambdaParser.PRIMITIVE_DATA_OP, 0)
        def data(self):
            return self.getTypedRuleContext(PLambdaParser.DataContext,0)


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

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

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



    def expression(self):

        localctx = PLambdaParser.ExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_expression)
        self._la = 0 # Token type
        try:
            self.state = 163
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,13,self._ctx)
            if la_ == 1:
                localctx = PLambdaParser.SeqExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 25
                self.match(PLambdaParser.T__0)
                self.state = 26
                self.match(PLambdaParser.SEQ)
                self.state = 28 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 27
                    self.expression()
                    self.state = 30 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                        break

                self.state = 32
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 2:
                localctx = PLambdaParser.LetExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 34
                self.match(PLambdaParser.T__0)
                self.state = 35
                self.match(PLambdaParser.LET)
                self.state = 36
                self.bindingList()
                self.state = 38 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 37
                    self.expression()
                    self.state = 40 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                        break

                self.state = 42
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 3:
                localctx = PLambdaParser.DefineExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 44
                self.match(PLambdaParser.T__0)
                self.state = 45
                self.match(PLambdaParser.DEFINE)
                self.state = 46
                self.match(PLambdaParser.ID)
                self.state = 48
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
                if la_ == 1:
                    self.state = 47
                    self.parameterList()


                self.state = 51 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 50
                    self.expression()
                    self.state = 53 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                        break

                self.state = 55
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 4:
                localctx = PLambdaParser.LambdaExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 57
                self.match(PLambdaParser.T__0)
                self.state = 58
                self.match(PLambdaParser.LAMBDA)
                self.state = 59
                self.parameterList()
                self.state = 61 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 60
                    self.expression()
                    self.state = 63 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                        break

                self.state = 65
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 5:
                localctx = PLambdaParser.InvokeExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 67
                self.match(PLambdaParser.T__0)
                self.state = 68
                self.match(PLambdaParser.INVOKE)
                self.state = 69
                self.expression()
                self.state = 70
                self.expression()
                self.state = 74
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0):
                    self.state = 71
                    self.expression()
                    self.state = 76
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 77
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 6:
                localctx = PLambdaParser.ApplyExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 79
                self.match(PLambdaParser.T__0)
                self.state = 80
                self.match(PLambdaParser.APPLY)
                self.state = 81
                self.expression()
                self.state = 85
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0):
                    self.state = 82
                    self.expression()
                    self.state = 87
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 88
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 7:
                localctx = PLambdaParser.DataExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 90
                self.match(PLambdaParser.T__0)
                self.state = 91
                self.match(PLambdaParser.PRIMITIVE_DATA_OP)
                self.state = 92
                self.data()
                self.state = 93
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 8:
                localctx = PLambdaParser.UnaryExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 95
                self.match(PLambdaParser.T__0)
                self.state = 96
                self.match(PLambdaParser.UNARY_OP)
                self.state = 97
                self.expression()
                self.state = 98
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 9:
                localctx = PLambdaParser.BinaryExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 9)
                self.state = 100
                self.match(PLambdaParser.T__0)
                self.state = 101
                self.match(PLambdaParser.BINARY_OP)
                self.state = 102
                self.expression()
                self.state = 103
                self.expression()
                self.state = 104
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 10:
                localctx = PLambdaParser.TernaryExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 10)
                self.state = 106
                self.match(PLambdaParser.T__0)
                self.state = 107
                self.match(PLambdaParser.TERNARY_OP)
                self.state = 108
                self.expression()
                self.state = 109
                self.expression()
                self.state = 110
                self.expression()
                self.state = 111
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 11:
                localctx = PLambdaParser.OneOrMoreExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 11)
                self.state = 113
                self.match(PLambdaParser.T__0)
                self.state = 114
                self.match(PLambdaParser.AMBI1_OP)
                self.state = 115
                self.expression()
                self.state = 117
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0):
                    self.state = 116
                    self.expression()


                self.state = 119
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 12:
                localctx = PLambdaParser.TwoOrMoreExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 12)
                self.state = 121
                self.match(PLambdaParser.T__0)
                self.state = 122
                self.match(PLambdaParser.AMBI2_OP)
                self.state = 123
                self.expression()
                self.state = 124
                self.expression()
                self.state = 126
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0):
                    self.state = 125
                    self.expression()


                self.state = 128
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 13:
                localctx = PLambdaParser.NaryExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 13)
                self.state = 130
                self.match(PLambdaParser.T__0)
                self.state = 131
                self.match(PLambdaParser.N_ARY_OP)
                self.state = 135
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0):
                    self.state = 132
                    self.expression()
                    self.state = 137
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 138
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 14:
                localctx = PLambdaParser.TryExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 14)
                self.state = 139
                self.match(PLambdaParser.T__0)
                self.state = 140
                self.match(PLambdaParser.TRY)
                self.state = 142 
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 141
                        self.expression()

                    else:
                        raise NoViableAltException(self)
                    self.state = 144 
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,11,self._ctx)

                self.state = 146
                self.catchExpression()
                self.state = 147
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 15:
                localctx = PLambdaParser.ForExpressionContext(self, localctx)
                self.enterOuterAlt(localctx, 15)
                self.state = 149
                self.match(PLambdaParser.T__0)
                self.state = 150
                self.match(PLambdaParser.FOR)
                self.state = 151
                self.match(PLambdaParser.ID)
                self.state = 152
                self.rangeExpression()
                self.state = 154 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 153
                    self.expression()
                    self.state = 156 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                        break

                self.state = 158
                self.match(PLambdaParser.T__1)
                pass

            elif la_ == 16:
                localctx = PLambdaParser.StringLiteralContext(self, localctx)
                self.enterOuterAlt(localctx, 16)
                self.state = 160
                self.match(PLambdaParser.STRING)
                pass

            elif la_ == 17:
                localctx = PLambdaParser.IdentifierLiteralContext(self, localctx)
                self.enterOuterAlt(localctx, 17)
                self.state = 161
                self.match(PLambdaParser.ID)
                pass

            elif la_ == 18:
                localctx = PLambdaParser.NoneLiteralContext(self, localctx)
                self.enterOuterAlt(localctx, 18)
                self.state = 162
                self.match(PLambdaParser.NONE)
                pass


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


    class ParameterListContext(ParserRuleContext):

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

        def parameter(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ParameterContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ParameterContext,i)


        def getRuleIndex(self):
            return PLambdaParser.RULE_parameterList

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

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

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




    def parameterList(self):

        localctx = PLambdaParser.ParameterListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_parameterList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 165
            self.match(PLambdaParser.T__0)
            self.state = 169
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==PLambdaParser.ID:
                self.state = 166
                self.parameter()
                self.state = 171
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 172
            self.match(PLambdaParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ParameterContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return PLambdaParser.RULE_parameter

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

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

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




    def parameter(self):

        localctx = PLambdaParser.ParameterContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_parameter)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 174
            self.match(PLambdaParser.ID)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BindingListContext(ParserRuleContext):

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

        def bindingPair(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.BindingPairContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.BindingPairContext,i)


        def getRuleIndex(self):
            return PLambdaParser.RULE_bindingList

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

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

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




    def bindingList(self):

        localctx = PLambdaParser.BindingListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_bindingList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 176
            self.match(PLambdaParser.T__0)
            self.state = 178 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 177
                self.bindingPair()
                self.state = 180 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==PLambdaParser.T__0):
                    break

            self.state = 182
            self.match(PLambdaParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BindingPairContext(ParserRuleContext):

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

        def parameter(self):
            return self.getTypedRuleContext(PLambdaParser.ParameterContext,0)


        def expression(self):
            return self.getTypedRuleContext(PLambdaParser.ExpressionContext,0)


        def getRuleIndex(self):
            return PLambdaParser.RULE_bindingPair

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

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

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




    def bindingPair(self):

        localctx = PLambdaParser.BindingPairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_bindingPair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 184
            self.match(PLambdaParser.T__0)
            self.state = 185
            self.parameter()
            self.state = 186
            self.expression()
            self.state = 187
            self.match(PLambdaParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CatchExpressionContext(ParserRuleContext):

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

        def CATCH(self):
            return self.getToken(PLambdaParser.CATCH, 0)

        def parameter(self):
            return self.getTypedRuleContext(PLambdaParser.ParameterContext,0)


        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PLambdaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(PLambdaParser.ExpressionContext,i)


        def getRuleIndex(self):
            return PLambdaParser.RULE_catchExpression

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

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

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




    def catchExpression(self):

        localctx = PLambdaParser.CatchExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_catchExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.match(PLambdaParser.T__0)
            self.state = 190
            self.match(PLambdaParser.CATCH)
            self.state = 191
            self.parameter()
            self.state = 193 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 192
                self.expression()
                self.state = 195 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << PLambdaParser.T__0) | (1 << PLambdaParser.STRING) | (1 << PLambdaParser.NONE) | (1 << PLambdaParser.ID))) != 0)):
                    break

            self.state = 197
            self.match(PLambdaParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RangeExpressionContext(ParserRuleContext):

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

        def expression(self):
            return self.getTypedRuleContext(PLambdaParser.ExpressionContext,0)


        def getRuleIndex(self):
            return PLambdaParser.RULE_rangeExpression

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

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

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




    def rangeExpression(self):

        localctx = PLambdaParser.RangeExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_rangeExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 199
            self.expression()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DataContext(ParserRuleContext):

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

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

        def NUMBER(self):
            return self.getToken(PLambdaParser.NUMBER, 0)

        def getRuleIndex(self):
            return PLambdaParser.RULE_data

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

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

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




    def data(self):

        localctx = PLambdaParser.DataContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_data)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 201
            _la = self._input.LA(1)
            if not(_la==PLambdaParser.ID or _la==PLambdaParser.NUMBER):
                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 TokenContext(ParserRuleContext):

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

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

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

        def getRuleIndex(self):
            return PLambdaParser.RULE_token

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

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

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




    def token(self):

        localctx = PLambdaParser.TokenContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_token)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 203
            _la = self._input.LA(1)
            if not(_la==PLambdaParser.STRING or _la==PLambdaParser.ID):
                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





