text: # Generated from seedot.g4 by ANTLR 4.7
  # 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&")
          buf.write("\u009c\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\3\2\3\2")
          buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
          buf.write("\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2")
          buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
          buf.write("\2\3\2\3\2\3\2\3\2\3\2\7\2=\n\2\f\2\16\2@\13\2\3\2\3\2")
          buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
          buf.write("\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2")
          buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
          buf.write("\2\3\2\3\2\3\2\5\2p\n\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
          buf.write("\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2")
          buf.write("\3\2\3\2\7\2\u0089\n\2\f\2\16\2\u008c\13\2\3\3\3\3\3\4")
          buf.write("\3\4\3\5\3\5\3\6\3\6\3\6\7\6\u0097\n\6\f\6\16\6\u009a")
          buf.write("\13\6\3\6\2\3\2\7\2\4\6\b\n\2\5\3\2\16\17\3\2\20\25\3")
          buf.write("\2\26\33\2\u00aa\2o\3\2\2\2\4\u008d\3\2\2\2\6\u008f\3")
          buf.write("\2\2\2\b\u0091\3\2\2\2\n\u0093\3\2\2\2\f\r\b\2\1\2\rp")
          buf.write("\7#\2\2\16p\7$\2\2\17p\7\"\2\2\20\21\7\3\2\2\21\22\5\n")
          buf.write("\6\2\22\23\7\4\2\2\23\24\7!\2\2\24\25\7\5\2\2\25\26\7")
          buf.write("$\2\2\26\27\7\6\2\2\27\30\7$\2\2\30\31\7\7\2\2\31p\3\2")
          buf.write("\2\2\32\33\7\b\2\2\33\34\7\3\2\2\34\35\7\5\2\2\35\36\5")
          buf.write("\n\6\2\36\37\7\7\2\2\37 \7\6\2\2 !\7$\2\2!\"\7\4\2\2\"")
          buf.write("p\3\2\2\2#$\7\34\2\2$%\7\3\2\2%&\5\2\2\2&\'\7\6\2\2\'")
          buf.write("(\7\3\2\2()\5\n\6\2)*\7\4\2\2*+\7\6\2\2+,\7\3\2\2,-\5")
          buf.write("\n\6\2-.\7\4\2\2./\7\4\2\2/p\3\2\2\2\60\61\7\35\2\2\61")
          buf.write("\62\7\3\2\2\62\63\5\2\2\2\63\64\7\6\2\2\64\65\7#\2\2\65")
          buf.write("\66\7\4\2\2\66p\3\2\2\2\678\7\"\2\289\7\3\2\29>\5\2\2")
          buf.write("\2:;\7\6\2\2;=\5\2\2\2<:\3\2\2\2=@\3\2\2\2><\3\2\2\2>")
          buf.write("?\3\2\2\2?A\3\2\2\2@>\3\2\2\2AB\7\4\2\2Bp\3\2\2\2CD\5")
          buf.write("\4\3\2DE\5\2\2\13Ep\3\2\2\2FG\5\b\5\2GH\7\3\2\2HI\5\2")
          buf.write("\2\2IJ\7\4\2\2Jp\3\2\2\2KL\7\36\2\2LM\7\3\2\2MN\7\"\2")
          buf.write("\2NO\7\n\2\2OP\7\5\2\2PQ\7#\2\2QR\7\13\2\2RS\7#\2\2ST")
          buf.write("\7\7\2\2TU\7\4\2\2Up\5\2\2\7VW\7\37\2\2WX\7\3\2\2XY\7")
          buf.write("\"\2\2YZ\7\n\2\2Z[\7\5\2\2[\\\7#\2\2\\]\7\13\2\2]^\7#")
          buf.write("\2\2^_\7\7\2\2_`\7\6\2\2`a\5\2\2\2ab\7\4\2\2bc\5\2\2\6")
          buf.write("cp\3\2\2\2de\7 \2\2ef\7\"\2\2fg\7\n\2\2gh\5\2\2\2hi\7")
          buf.write("!\2\2ij\5\2\2\4jp\3\2\2\2kl\7\3\2\2lm\5\2\2\2mn\7\4\2")
          buf.write("\2np\3\2\2\2o\f\3\2\2\2o\16\3\2\2\2o\17\3\2\2\2o\20\3")
          buf.write("\2\2\2o\32\3\2\2\2o#\3\2\2\2o\60\3\2\2\2o\67\3\2\2\2o")
          buf.write("C\3\2\2\2oF\3\2\2\2oK\3\2\2\2oV\3\2\2\2od\3\2\2\2ok\3")
          buf.write("\2\2\2p\u008a\3\2\2\2qr\f\n\2\2rs\5\6\4\2st\5\2\2\13t")
          buf.write("\u0089\3\2\2\2uv\f\t\2\2vw\5\4\3\2wx\5\2\2\nx\u0089\3")
          buf.write("\2\2\2yz\f\5\2\2z{\7\f\2\2{|\7#\2\2|}\7\r\2\2}~\5\2\2")
          buf.write("\2~\177\7\13\2\2\177\u0080\5\2\2\6\u0080\u0089\3\2\2\2")
          buf.write("\u0081\u0082\f\20\2\2\u0082\u0089\7\t\2\2\u0083\u0084")
          buf.write("\f\r\2\2\u0084\u0085\7\5\2\2\u0085\u0086\5\2\2\2\u0086")
          buf.write("\u0087\7\7\2\2\u0087\u0089\3\2\2\2\u0088q\3\2\2\2\u0088")
          buf.write("u\3\2\2\2\u0088y\3\2\2\2\u0088\u0081\3\2\2\2\u0088\u0083")
          buf.write("\3\2\2\2\u0089\u008c\3\2\2\2\u008a\u0088\3\2\2\2\u008a")
          buf.write("\u008b\3\2\2\2\u008b\3\3\2\2\2\u008c\u008a\3\2\2\2\u008d")
          buf.write("\u008e\t\2\2\2\u008e\5\3\2\2\2\u008f\u0090\t\3\2\2\u0090")
          buf.write("\7\3\2\2\2\u0091\u0092\t\4\2\2\u0092\t\3\2\2\2\u0093\u0098")
          buf.write("\7#\2\2\u0094\u0095\7\6\2\2\u0095\u0097\7#\2\2\u0096\u0094")
          buf.write("\3\2\2\2\u0097\u009a\3\2\2\2\u0098\u0096\3\2\2\2\u0098")
          buf.write("\u0099\3\2\2\2\u0099\13\3\2\2\2\u009a\u0098\3\2\2\2\7")
          buf.write(">o\u0088\u008a\u0098")
          return buf.getvalue()
  
  
  class seedotParser ( Parser ):
  
      grammarFileName = "seedot.g4"
  
      atn = ATNDeserializer().deserialize(serializedATN())
  
      decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
  
      sharedContextCache = PredictionContextCache()
  
      literalNames = [ "<INVALID>", "'('", "')'", "'['", "','", "']'", "'init'", 
                       "'^T'", "'='", "':'", "'>='", "'?'", "'+'", "'-'", 
                       "'*'", "'|*|'", "'<*>'", "'#'", "'<+>'", "'<->'", "'relu'", 
                       "'exp'", "'argmax'", "'sgn'", "'tanh'", "'sigmoid'", 
                       "'reshape'", "'maxpool'", "'$'", "'loop'", "'let'", 
                       "'in'" ]
  
      symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                        "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                        "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                        "ADD", "SUB", "MUL", "SPARSEMUL", "MULCIR", "CONV", 
                        "ADDCIR", "SUBCIR", "RELU", "EXP", "ARGMAX", "SGN", 
                        "TANH", "SIGMOID", "Reshape", "Maxpool", "Sum", "Loop", 
                        "Let", "In", "Id", "IntConst", "FloatConst", "WS", 
                        "LineComment" ]
  
      RULE_expr = 0
      RULE_addOp = 1
      RULE_binOp = 2
      RULE_specialFunc = 3
      RULE_intConstList = 4
  
      ruleNames =  [ "expr", "addOp", "binOp", "specialFunc", "intConstList" ]
  
      EOF = Token.EOF
      T__0=1
      T__1=2
      T__2=3
      T__3=4
      T__4=5
      T__5=6
      T__6=7
      T__7=8
      T__8=9
      T__9=10
      T__10=11
      ADD=12
      SUB=13
      MUL=14
      SPARSEMUL=15
      MULCIR=16
      CONV=17
      ADDCIR=18
      SUBCIR=19
      RELU=20
      EXP=21
      ARGMAX=22
      SGN=23
      TANH=24
      SIGMOID=25
      Reshape=26
      Maxpool=27
      Sum=28
      Loop=29
      Let=30
      In=31
      Id=32
      IntConst=33
      FloatConst=34
      WS=35
      LineComment=36
  
      def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
          super().__init__(input, output)
          self.checkVersion("4.7")
          self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
          self._predicates = None
  
  
  
      class ExprContext(ParserRuleContext):
  
          def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
              super().__init__(parent, invokingState)
              self.parser = parser
  
  
          def getRuleIndex(self):
              return seedotParser.RULE_expr
  
       
          def copyFrom(self, ctx:ParserRuleContext):
              super().copyFrom(ctx)
  
  
      class Bop1Context(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
          def binOp(self):
              return self.getTypedRuleContext(seedotParser.BinOpContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitBop1" ):
                  return visitor.visitBop1(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class InitContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def intConstList(self):
              return self.getTypedRuleContext(seedotParser.IntConstListContext,0)
  
          def FloatConst(self):
              return self.getToken(seedotParser.FloatConst, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitInit" ):
                  return visitor.visitInit(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class Bop2Context(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
          def addOp(self):
              return self.getTypedRuleContext(seedotParser.AddOpContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitBop2" ):
                  return visitor.visitBop2(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class DeclContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def intConstList(self):
              return self.getTypedRuleContext(seedotParser.IntConstListContext,0)
  
          def In(self):
              return self.getToken(seedotParser.In, 0)
          def FloatConst(self, i:int=None):
              if i is None:
                  return self.getTokens(seedotParser.FloatConst)
              else:
                  return self.getToken(seedotParser.FloatConst, i)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitDecl" ):
                  return visitor.visitDecl(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class IndexContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitIndex" ):
                  return visitor.visitIndex(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class SumContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Sum(self):
              return self.getToken(seedotParser.Sum, 0)
          def Id(self):
              return self.getToken(seedotParser.Id, 0)
          def IntConst(self, i:int=None):
              if i is None:
                  return self.getTokens(seedotParser.IntConst)
              else:
                  return self.getToken(seedotParser.IntConst, i)
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitSum" ):
                  return visitor.visitSum(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class ReshapeContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Reshape(self):
              return self.getToken(seedotParser.Reshape, 0)
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
          def intConstList(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.IntConstListContext)
              else:
                  return self.getTypedRuleContext(seedotParser.IntConstListContext,i)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitReshape" ):
                  return visitor.visitReshape(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class FloatContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def FloatConst(self):
              return self.getToken(seedotParser.FloatConst, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitFloat" ):
                  return visitor.visitFloat(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class CondContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
          def IntConst(self):
              return self.getToken(seedotParser.IntConst, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitCond" ):
                  return visitor.visitCond(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class IntContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def IntConst(self):
              return self.getToken(seedotParser.IntConst, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitInt" ):
                  return visitor.visitInt(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class TranspContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitTransp" ):
                  return visitor.visitTransp(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class ParenContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitParen" ):
                  return visitor.visitParen(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class FuncContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def specialFunc(self):
              return self.getTypedRuleContext(seedotParser.SpecialFuncContext,0)
  
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitFunc" ):
                  return visitor.visitFunc(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class LoopContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Loop(self):
              return self.getToken(seedotParser.Loop, 0)
          def Id(self):
              return self.getToken(seedotParser.Id, 0)
          def IntConst(self, i:int=None):
              if i is None:
                  return self.getTokens(seedotParser.IntConst)
              else:
                  return self.getToken(seedotParser.IntConst, i)
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitLoop" ):
                  return visitor.visitLoop(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class UopContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def addOp(self):
              return self.getTypedRuleContext(seedotParser.AddOpContext,0)
  
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitUop" ):
                  return visitor.visitUop(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class LetContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Let(self):
              return self.getToken(seedotParser.Let, 0)
          def Id(self):
              return self.getToken(seedotParser.Id, 0)
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
          def In(self):
              return self.getToken(seedotParser.In, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitLet" ):
                  return visitor.visitLet(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class IdContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Id(self):
              return self.getToken(seedotParser.Id, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitId" ):
                  return visitor.visitId(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class FuncCallContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Id(self):
              return self.getToken(seedotParser.Id, 0)
          def expr(self, i:int=None):
              if i is None:
                  return self.getTypedRuleContexts(seedotParser.ExprContext)
              else:
                  return self.getTypedRuleContext(seedotParser.ExprContext,i)
  
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitFuncCall" ):
                  return visitor.visitFuncCall(self)
              else:
                  return visitor.visitChildren(self)
  
  
      class MaxpoolContext(ExprContext):
  
          def __init__(self, parser, ctx:ParserRuleContext): # actually a seedotParser.ExprContext
              super().__init__(parser)
              self.copyFrom(ctx)
  
          def Maxpool(self):
              return self.getToken(seedotParser.Maxpool, 0)
          def expr(self):
              return self.getTypedRuleContext(seedotParser.ExprContext,0)
  
          def IntConst(self):
              return self.getToken(seedotParser.IntConst, 0)
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitMaxpool" ):
                  return visitor.visitMaxpool(self)
              else:
                  return visitor.visitChildren(self)
  
  
  
      def expr(self, _p:int=0):
          _parentctx = self._ctx
          _parentState = self.state
          localctx = seedotParser.ExprContext(self, self._ctx, _parentState)
          _prevctx = localctx
          _startState = 0
          self.enterRecursionRule(localctx, 0, self.RULE_expr, _p)
          self._la = 0 # Token type
          try:
              self.enterOuterAlt(localctx, 1)
              self.state = 109
              self._errHandler.sync(self)
              la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
              if la_ == 1:
                  localctx = seedotParser.IntContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
  
                  self.state = 11
                  self.match(seedotParser.IntConst)
                  pass
  
              elif la_ == 2:
                  localctx = seedotParser.FloatContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 12
                  self.match(seedotParser.FloatConst)
                  pass
  
              elif la_ == 3:
                  localctx = seedotParser.IdContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 13
                  self.match(seedotParser.Id)
                  pass
  
              elif la_ == 4:
                  localctx = seedotParser.DeclContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 14
                  self.match(seedotParser.T__0)
                  self.state = 15
                  self.intConstList()
                  self.state = 16
                  self.match(seedotParser.T__1)
                  self.state = 17
                  self.match(seedotParser.In)
                  self.state = 18
                  self.match(seedotParser.T__2)
                  self.state = 19
                  self.match(seedotParser.FloatConst)
                  self.state = 20
                  self.match(seedotParser.T__3)
                  self.state = 21
                  self.match(seedotParser.FloatConst)
                  self.state = 22
                  self.match(seedotParser.T__4)
                  pass
  
              elif la_ == 5:
                  localctx = seedotParser.InitContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 24
                  self.match(seedotParser.T__5)
                  self.state = 25
                  self.match(seedotParser.T__0)
                  self.state = 26
                  self.match(seedotParser.T__2)
                  self.state = 27
                  self.intConstList()
                  self.state = 28
                  self.match(seedotParser.T__4)
                  self.state = 29
                  self.match(seedotParser.T__3)
                  self.state = 30
                  self.match(seedotParser.FloatConst)
                  self.state = 31
                  self.match(seedotParser.T__1)
                  pass
  
              elif la_ == 6:
                  localctx = seedotParser.ReshapeContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 33
                  self.match(seedotParser.Reshape)
                  self.state = 34
                  self.match(seedotParser.T__0)
                  self.state = 35
                  self.expr(0)
                  self.state = 36
                  self.match(seedotParser.T__3)
                  self.state = 37
                  self.match(seedotParser.T__0)
                  self.state = 38
                  self.intConstList()
                  self.state = 39
                  self.match(seedotParser.T__1)
                  self.state = 40
                  self.match(seedotParser.T__3)
                  self.state = 41
                  self.match(seedotParser.T__0)
                  self.state = 42
                  self.intConstList()
                  self.state = 43
                  self.match(seedotParser.T__1)
                  self.state = 44
                  self.match(seedotParser.T__1)
                  pass
  
              elif la_ == 7:
                  localctx = seedotParser.MaxpoolContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 46
                  self.match(seedotParser.Maxpool)
                  self.state = 47
                  self.match(seedotParser.T__0)
                  self.state = 48
                  self.expr(0)
                  self.state = 49
                  self.match(seedotParser.T__3)
                  self.state = 50
                  self.match(seedotParser.IntConst)
                  self.state = 51
                  self.match(seedotParser.T__1)
                  pass
  
              elif la_ == 8:
                  localctx = seedotParser.FuncCallContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 53
                  self.match(seedotParser.Id)
                  self.state = 54
                  self.match(seedotParser.T__0)
                  self.state = 55
                  self.expr(0)
                  self.state = 60
                  self._errHandler.sync(self)
                  _la = self._input.LA(1)
                  while _la==seedotParser.T__3:
                      self.state = 56
                      self.match(seedotParser.T__3)
                      self.state = 57
                      self.expr(0)
                      self.state = 62
                      self._errHandler.sync(self)
                      _la = self._input.LA(1)
  
                  self.state = 63
                  self.match(seedotParser.T__1)
                  pass
  
              elif la_ == 9:
                  localctx = seedotParser.UopContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 65
                  self.addOp()
                  self.state = 66
                  self.expr(9)
                  pass
  
              elif la_ == 10:
                  localctx = seedotParser.FuncContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 68
                  self.specialFunc()
                  self.state = 69
                  self.match(seedotParser.T__0)
                  self.state = 70
                  self.expr(0)
                  self.state = 71
                  self.match(seedotParser.T__1)
                  pass
  
              elif la_ == 11:
                  localctx = seedotParser.SumContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 73
                  self.match(seedotParser.Sum)
                  self.state = 74
                  self.match(seedotParser.T__0)
                  self.state = 75
                  self.match(seedotParser.Id)
                  self.state = 76
                  self.match(seedotParser.T__7)
                  self.state = 77
                  self.match(seedotParser.T__2)
                  self.state = 78
                  self.match(seedotParser.IntConst)
                  self.state = 79
                  self.match(seedotParser.T__8)
                  self.state = 80
                  self.match(seedotParser.IntConst)
                  self.state = 81
                  self.match(seedotParser.T__4)
                  self.state = 82
                  self.match(seedotParser.T__1)
                  self.state = 83
                  self.expr(5)
                  pass
  
              elif la_ == 12:
                  localctx = seedotParser.LoopContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 84
                  self.match(seedotParser.Loop)
                  self.state = 85
                  self.match(seedotParser.T__0)
                  self.state = 86
                  self.match(seedotParser.Id)
                  self.state = 87
                  self.match(seedotParser.T__7)
                  self.state = 88
                  self.match(seedotParser.T__2)
                  self.state = 89
                  self.match(seedotParser.IntConst)
                  self.state = 90
                  self.match(seedotParser.T__8)
                  self.state = 91
                  self.match(seedotParser.IntConst)
                  self.state = 92
                  self.match(seedotParser.T__4)
                  self.state = 93
                  self.match(seedotParser.T__3)
                  self.state = 94
                  self.expr(0)
                  self.state = 95
                  self.match(seedotParser.T__1)
                  self.state = 96
                  self.expr(4)
                  pass
  
              elif la_ == 13:
                  localctx = seedotParser.LetContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 98
                  self.match(seedotParser.Let)
                  self.state = 99
                  self.match(seedotParser.Id)
                  self.state = 100
                  self.match(seedotParser.T__7)
                  self.state = 101
                  self.expr(0)
                  self.state = 102
                  self.match(seedotParser.In)
                  self.state = 103
                  self.expr(2)
                  pass
  
              elif la_ == 14:
                  localctx = seedotParser.ParenContext(self, localctx)
                  self._ctx = localctx
                  _prevctx = localctx
                  self.state = 105
                  self.match(seedotParser.T__0)
                  self.state = 106
                  self.expr(0)
                  self.state = 107
                  self.match(seedotParser.T__1)
                  pass
  
  
              self._ctx.stop = self._input.LT(-1)
              self.state = 136
              self._errHandler.sync(self)
              _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
              while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                  if _alt==1:
                      if self._parseListeners is not None:
                          self.triggerExitRuleEvent()
                      _prevctx = localctx
                      self.state = 134
                      self._errHandler.sync(self)
                      la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
                      if la_ == 1:
                          localctx = seedotParser.Bop1Context(self, seedotParser.ExprContext(self, _parentctx, _parentState))
                          self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                          self.state = 111
                          if not self.precpred(self._ctx, 8):
                              from antlr4.error.Errors import FailedPredicateException
                              raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                          self.state = 112
                          self.binOp()
                          self.state = 113
                          self.expr(9)
                          pass
  
                      elif la_ == 2:
                          localctx = seedotParser.Bop2Context(self, seedotParser.ExprContext(self, _parentctx, _parentState))
                          self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                          self.state = 115
                          if not self.precpred(self._ctx, 7):
                              from antlr4.error.Errors import FailedPredicateException
                              raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                          self.state = 116
                          self.addOp()
                          self.state = 117
                          self.expr(8)
                          pass
  
                      elif la_ == 3:
                          localctx = seedotParser.CondContext(self, seedotParser.ExprContext(self, _parentctx, _parentState))
                          self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                          self.state = 119
                          if not self.precpred(self._ctx, 3):
                              from antlr4.error.Errors import FailedPredicateException
                              raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                          self.state = 120
                          self.match(seedotParser.T__9)
                          self.state = 121
                          self.match(seedotParser.IntConst)
                          self.state = 122
                          self.match(seedotParser.T__10)
                          self.state = 123
                          self.expr(0)
                          self.state = 124
                          self.match(seedotParser.T__8)
                          self.state = 125
                          self.expr(4)
                          pass
  
                      elif la_ == 4:
                          localctx = seedotParser.TranspContext(self, seedotParser.ExprContext(self, _parentctx, _parentState))
                          self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                          self.state = 127
                          if not self.precpred(self._ctx, 14):
                              from antlr4.error.Errors import FailedPredicateException
                              raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                          self.state = 128
                          self.match(seedotParser.T__6)
                          pass
  
                      elif la_ == 5:
                          localctx = seedotParser.IndexContext(self, seedotParser.ExprContext(self, _parentctx, _parentState))
                          self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                          self.state = 129
                          if not self.precpred(self._ctx, 11):
                              from antlr4.error.Errors import FailedPredicateException
                              raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                          self.state = 130
                          self.match(seedotParser.T__2)
                          self.state = 131
                          self.expr(0)
                          self.state = 132
                          self.match(seedotParser.T__4)
                          pass
  
               
                  self.state = 138
                  self._errHandler.sync(self)
                  _alt = self._interp.adaptivePredict(self._input,3,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 AddOpContext(ParserRuleContext):
  
          def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
              super().__init__(parent, invokingState)
              self.parser = parser
  
          def ADD(self):
              return self.getToken(seedotParser.ADD, 0)
  
          def SUB(self):
              return self.getToken(seedotParser.SUB, 0)
  
          def getRuleIndex(self):
              return seedotParser.RULE_addOp
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitAddOp" ):
                  return visitor.visitAddOp(self)
              else:
                  return visitor.visitChildren(self)
  
  
  
  
      def addOp(self):
  
          localctx = seedotParser.AddOpContext(self, self._ctx, self.state)
          self.enterRule(localctx, 2, self.RULE_addOp)
          self._la = 0 # Token type
          try:
              self.enterOuterAlt(localctx, 1)
              self.state = 139
              _la = self._input.LA(1)
              if not(_la==seedotParser.ADD or _la==seedotParser.SUB):
                  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 BinOpContext(ParserRuleContext):
  
          def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
              super().__init__(parent, invokingState)
              self.parser = parser
  
          def MUL(self):
              return self.getToken(seedotParser.MUL, 0)
  
          def SPARSEMUL(self):
              return self.getToken(seedotParser.SPARSEMUL, 0)
  
          def MULCIR(self):
              return self.getToken(seedotParser.MULCIR, 0)
  
          def CONV(self):
              return self.getToken(seedotParser.CONV, 0)
  
          def ADDCIR(self):
              return self.getToken(seedotParser.ADDCIR, 0)
  
          def SUBCIR(self):
              return self.getToken(seedotParser.SUBCIR, 0)
  
          def getRuleIndex(self):
              return seedotParser.RULE_binOp
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitBinOp" ):
                  return visitor.visitBinOp(self)
              else:
                  return visitor.visitChildren(self)
  
  
  
  
      def binOp(self):
  
          localctx = seedotParser.BinOpContext(self, self._ctx, self.state)
          self.enterRule(localctx, 4, self.RULE_binOp)
          self._la = 0 # Token type
          try:
              self.enterOuterAlt(localctx, 1)
              self.state = 141
              _la = self._input.LA(1)
              if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << seedotParser.MUL) | (1 << seedotParser.SPARSEMUL) | (1 << seedotParser.MULCIR) | (1 << seedotParser.CONV) | (1 << seedotParser.ADDCIR) | (1 << seedotParser.SUBCIR))) != 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 SpecialFuncContext(ParserRuleContext):
  
          def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
              super().__init__(parent, invokingState)
              self.parser = parser
  
          def RELU(self):
              return self.getToken(seedotParser.RELU, 0)
  
          def EXP(self):
              return self.getToken(seedotParser.EXP, 0)
  
          def ARGMAX(self):
              return self.getToken(seedotParser.ARGMAX, 0)
  
          def SGN(self):
              return self.getToken(seedotParser.SGN, 0)
  
          def TANH(self):
              return self.getToken(seedotParser.TANH, 0)
  
          def SIGMOID(self):
              return self.getToken(seedotParser.SIGMOID, 0)
  
          def getRuleIndex(self):
              return seedotParser.RULE_specialFunc
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitSpecialFunc" ):
                  return visitor.visitSpecialFunc(self)
              else:
                  return visitor.visitChildren(self)
  
  
  
  
      def specialFunc(self):
  
          localctx = seedotParser.SpecialFuncContext(self, self._ctx, self.state)
          self.enterRule(localctx, 6, self.RULE_specialFunc)
          self._la = 0 # Token type
          try:
              self.enterOuterAlt(localctx, 1)
              self.state = 143
              _la = self._input.LA(1)
              if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << seedotParser.RELU) | (1 << seedotParser.EXP) | (1 << seedotParser.ARGMAX) | (1 << seedotParser.SGN) | (1 << seedotParser.TANH) | (1 << seedotParser.SIGMOID))) != 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 IntConstListContext(ParserRuleContext):
  
          def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
              super().__init__(parent, invokingState)
              self.parser = parser
  
          def IntConst(self, i:int=None):
              if i is None:
                  return self.getTokens(seedotParser.IntConst)
              else:
                  return self.getToken(seedotParser.IntConst, i)
  
          def getRuleIndex(self):
              return seedotParser.RULE_intConstList
  
          def accept(self, visitor:ParseTreeVisitor):
              if hasattr( visitor, "visitIntConstList" ):
                  return visitor.visitIntConstList(self)
              else:
                  return visitor.visitChildren(self)
  
  
  
  
      def intConstList(self):
  
          localctx = seedotParser.IntConstListContext(self, self._ctx, self.state)
          self.enterRule(localctx, 8, self.RULE_intConstList)
          self._la = 0 # Token type
          try:
              self.enterOuterAlt(localctx, 1)
              self.state = 145
              self.match(seedotParser.IntConst)
              self.state = 150
              self._errHandler.sync(self)
              _la = self._input.LA(1)
              while _la==seedotParser.T__3:
                  self.state = 146
                  self.match(seedotParser.T__3)
                  self.state = 147
                  self.match(seedotParser.IntConst)
                  self.state = 152
                  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[0] = self.expr_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 expr_sempred(self, localctx:ExprContext, predIndex:int):
              if predIndex == 0:
                  return self.precpred(self._ctx, 8)
           
  
              if predIndex == 1:
                  return self.precpred(self._ctx, 7)
           
  
              if predIndex == 2:
                  return self.precpred(self._ctx, 3)
           
  
              if predIndex == 3:
                  return self.precpred(self._ctx, 14)
           
  
              if predIndex == 4:
                  return self.precpred(self._ctx, 11)
           
  
  
  
  
  