summary refs log tree commit diff
path: root/gen/ANFParser.py
diff options
context:
space:
mode:
Diffstat (limited to 'gen/ANFParser.py')
-rw-r--r--gen/ANFParser.py639
1 files changed, 536 insertions, 103 deletions
diff --git a/gen/ANFParser.py b/gen/ANFParser.py
index 830af0c..b26614b 100644
--- a/gen/ANFParser.py
+++ b/gen/ANFParser.py
@@ -10,27 +10,44 @@ else:
 
 def serializedATN():
     return [
-        4,1,14,66,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
+        4,1,24,116,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
         0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
-        0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,0,39,8,0,1,1,1,1,1,1,1,1,1,1,
-        5,1,46,8,1,10,1,12,1,49,9,1,1,1,1,1,1,1,3,1,54,8,1,1,2,1,2,1,2,1,
-        2,1,2,1,2,1,2,1,2,3,2,64,8,2,1,2,0,0,3,0,2,4,0,0,71,0,38,1,0,0,0,
-        2,53,1,0,0,0,4,63,1,0,0,0,6,39,5,12,0,0,7,39,5,13,0,0,8,9,5,1,0,
-        0,9,10,3,0,0,0,10,11,5,2,0,0,11,12,3,0,0,0,12,13,5,3,0,0,13,39,1,
-        0,0,0,14,15,5,1,0,0,15,16,3,0,0,0,16,17,5,4,0,0,17,18,3,0,0,0,18,
-        19,5,3,0,0,19,39,1,0,0,0,20,21,5,1,0,0,21,22,3,0,0,0,22,23,5,5,0,
-        0,23,24,3,0,0,0,24,25,5,3,0,0,25,39,1,0,0,0,26,27,5,1,0,0,27,28,
-        3,0,0,0,28,29,5,6,0,0,29,30,3,0,0,0,30,31,5,3,0,0,31,39,1,0,0,0,
-        32,33,5,1,0,0,33,34,5,12,0,0,34,35,5,7,0,0,35,36,3,4,2,0,36,37,5,
-        3,0,0,37,39,1,0,0,0,38,6,1,0,0,0,38,7,1,0,0,0,38,8,1,0,0,0,38,14,
-        1,0,0,0,38,20,1,0,0,0,38,26,1,0,0,0,38,32,1,0,0,0,39,1,1,0,0,0,40,
-        41,5,12,0,0,41,42,5,1,0,0,42,47,3,0,0,0,43,44,5,8,0,0,44,46,3,0,
-        0,0,45,43,1,0,0,0,46,49,1,0,0,0,47,45,1,0,0,0,47,48,1,0,0,0,48,50,
-        1,0,0,0,49,47,1,0,0,0,50,51,5,3,0,0,51,54,1,0,0,0,52,54,3,0,0,0,
-        53,40,1,0,0,0,53,52,1,0,0,0,54,3,1,0,0,0,55,56,5,9,0,0,56,57,5,12,
-        0,0,57,58,5,10,0,0,58,59,3,2,1,0,59,60,5,11,0,0,60,61,3,4,2,0,61,
-        64,1,0,0,0,62,64,3,2,1,0,63,55,1,0,0,0,63,62,1,0,0,0,64,5,1,0,0,
-        0,4,38,47,53,63
+        0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
+        0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
+        0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
+        0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,0,89,8,0,1,1,1,1,1,1,
+        1,1,1,1,5,1,96,8,1,10,1,12,1,99,9,1,1,1,1,1,1,1,3,1,104,8,1,1,2,
+        1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,114,8,2,1,2,0,0,3,0,2,4,0,0,131,
+        0,88,1,0,0,0,2,103,1,0,0,0,4,113,1,0,0,0,6,89,5,1,0,0,7,89,5,2,0,
+        0,8,89,5,22,0,0,9,89,5,23,0,0,10,11,5,3,0,0,11,12,3,0,0,0,12,13,
+        5,4,0,0,13,14,3,0,0,0,14,15,5,5,0,0,15,89,1,0,0,0,16,17,5,3,0,0,
+        17,18,3,0,0,0,18,19,5,6,0,0,19,20,3,0,0,0,20,21,5,5,0,0,21,89,1,
+        0,0,0,22,23,5,3,0,0,23,24,3,0,0,0,24,25,5,7,0,0,25,26,3,0,0,0,26,
+        27,5,5,0,0,27,89,1,0,0,0,28,29,5,3,0,0,29,30,3,0,0,0,30,31,5,8,0,
+        0,31,32,3,0,0,0,32,33,5,5,0,0,33,89,1,0,0,0,34,35,5,3,0,0,35,36,
+        3,0,0,0,36,37,5,9,0,0,37,38,3,0,0,0,38,39,5,5,0,0,39,89,1,0,0,0,
+        40,41,5,3,0,0,41,42,3,0,0,0,42,43,5,10,0,0,43,44,3,0,0,0,44,45,5,
+        5,0,0,45,89,1,0,0,0,46,47,5,3,0,0,47,48,3,0,0,0,48,49,5,11,0,0,49,
+        50,3,0,0,0,50,51,5,5,0,0,51,89,1,0,0,0,52,53,5,3,0,0,53,54,3,0,0,
+        0,54,55,5,12,0,0,55,56,3,0,0,0,56,57,5,5,0,0,57,89,1,0,0,0,58,59,
+        5,3,0,0,59,60,3,0,0,0,60,61,5,13,0,0,61,62,3,0,0,0,62,63,5,5,0,0,
+        63,89,1,0,0,0,64,65,5,3,0,0,65,66,3,0,0,0,66,67,5,14,0,0,67,68,3,
+        0,0,0,68,69,5,5,0,0,69,89,1,0,0,0,70,71,5,3,0,0,71,72,3,0,0,0,72,
+        73,5,15,0,0,73,74,3,0,0,0,74,75,5,5,0,0,75,89,1,0,0,0,76,77,5,3,
+        0,0,77,78,3,0,0,0,78,79,5,16,0,0,79,80,3,0,0,0,80,81,5,5,0,0,81,
+        89,1,0,0,0,82,83,5,3,0,0,83,84,5,22,0,0,84,85,5,17,0,0,85,86,3,4,
+        2,0,86,87,5,5,0,0,87,89,1,0,0,0,88,6,1,0,0,0,88,7,1,0,0,0,88,8,1,
+        0,0,0,88,9,1,0,0,0,88,10,1,0,0,0,88,16,1,0,0,0,88,22,1,0,0,0,88,
+        28,1,0,0,0,88,34,1,0,0,0,88,40,1,0,0,0,88,46,1,0,0,0,88,52,1,0,0,
+        0,88,58,1,0,0,0,88,64,1,0,0,0,88,70,1,0,0,0,88,76,1,0,0,0,88,82,
+        1,0,0,0,89,1,1,0,0,0,90,91,5,22,0,0,91,92,5,3,0,0,92,97,3,0,0,0,
+        93,94,5,18,0,0,94,96,3,0,0,0,95,93,1,0,0,0,96,99,1,0,0,0,97,95,1,
+        0,0,0,97,98,1,0,0,0,98,100,1,0,0,0,99,97,1,0,0,0,100,101,5,5,0,0,
+        101,104,1,0,0,0,102,104,3,0,0,0,103,90,1,0,0,0,103,102,1,0,0,0,104,
+        3,1,0,0,0,105,106,5,19,0,0,106,107,5,22,0,0,107,108,5,20,0,0,108,
+        109,3,2,1,0,109,110,5,21,0,0,110,111,3,4,2,0,111,114,1,0,0,0,112,
+        114,3,2,1,0,113,105,1,0,0,0,113,112,1,0,0,0,114,5,1,0,0,0,4,88,97,
+        103,113
     ]
 
 class ANFParser ( Parser ):
@@ -43,13 +60,17 @@ class ANFParser ( Parser ):
 
     sharedContextCache = PredictionContextCache()
 
-    literalNames = [ "<INVALID>", "'('", "'+'", "')'", "'-'", "'*'", "'/'", 
-                     "':'", "','", "'let'", "'='", "'in'" ]
+    literalNames = [ "<INVALID>", "'true'", "'false'", "'('", "'+'", "')'", 
+                     "'-'", "'*'", "'/'", "'>'", "'<'", "'=='", "'<<'", 
+                     "'>>'", "'&&'", "'||'", "'^^'", "':'", "','", "'let'", 
+                     "'='", "'in'" ]
 
     symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                       "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                       "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
-                      "IDENT", "NUMBER", "WS" ]
+                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
+                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
+                      "<INVALID>", "<INVALID>", "IDENT", "NUMBER", "WS" ]
 
     RULE_aexp = 0
     RULE_funcall = 1
@@ -69,9 +90,19 @@ class ANFParser ( Parser ):
     T__8=9
     T__9=10
     T__10=11
-    IDENT=12
-    NUMBER=13
-    WS=14
+    T__11=12
+    T__12=13
+    T__13=14
+    T__14=15
+    T__15=16
+    T__16=17
+    T__17=18
+    T__18=19
+    T__19=20
+    T__20=21
+    IDENT=22
+    NUMBER=23
+    WS=24
 
     def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
         super().__init__(input, output)
@@ -127,7 +158,7 @@ class ANFParser ( Parser ):
                 return visitor.visitChildren(self)
 
 
-    class DivContext(AexpContext):
+    class BsrContext(AexpContext):
 
         def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
             super().__init__(parser)
@@ -141,16 +172,16 @@ class ANFParser ( Parser ):
 
 
         def enterRule(self, listener:ParseTreeListener):
-            if hasattr( listener, "enterDiv" ):
-                listener.enterDiv(self)
+            if hasattr( listener, "enterBsr" ):
+                listener.enterBsr(self)
 
         def exitRule(self, listener:ParseTreeListener):
-            if hasattr( listener, "exitDiv" ):
-                listener.exitDiv(self)
+            if hasattr( listener, "exitBsr" ):
+                listener.exitBsr(self)
 
         def accept(self, visitor:ParseTreeVisitor):
-            if hasattr( visitor, "visitDiv" ):
-                return visitor.visitDiv(self)
+            if hasattr( visitor, "visitBsr" ):
+                return visitor.visitBsr(self)
             else:
                 return visitor.visitChildren(self)
 
@@ -183,6 +214,34 @@ class ANFParser ( Parser ):
                 return visitor.visitChildren(self)
 
 
+    class OrContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterOr" ):
+                listener.enterOr(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitOr" ):
+                listener.exitOr(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitOr" ):
+                return visitor.visitOr(self)
+            else:
+                return visitor.visitChildren(self)
+
+
     class MulContext(AexpContext):
 
         def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
@@ -259,6 +318,190 @@ class ANFParser ( Parser ):
                 return visitor.visitChildren(self)
 
 
+    class FalseContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterFalse" ):
+                listener.enterFalse(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitFalse" ):
+                listener.exitFalse(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitFalse" ):
+                return visitor.visitFalse(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class LtContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterLt" ):
+                listener.enterLt(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitLt" ):
+                listener.exitLt(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitLt" ):
+                return visitor.visitLt(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class EqContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterEq" ):
+                listener.enterEq(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitEq" ):
+                listener.exitEq(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitEq" ):
+                return visitor.visitEq(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class GtContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterGt" ):
+                listener.enterGt(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitGt" ):
+                listener.exitGt(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitGt" ):
+                return visitor.visitGt(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class DivContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterDiv" ):
+                listener.enterDiv(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitDiv" ):
+                listener.exitDiv(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitDiv" ):
+                return visitor.visitDiv(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class AndContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterAnd" ):
+                listener.enterAnd(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitAnd" ):
+                listener.exitAnd(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitAnd" ):
+                return visitor.visitAnd(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class TrueContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterTrue" ):
+                listener.enterTrue(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitTrue" ):
+                listener.exitTrue(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitTrue" ):
+                return visitor.visitTrue(self)
+            else:
+                return visitor.visitChildren(self)
+
+
     class LamContext(AexpContext):
 
         def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
@@ -286,102 +529,292 @@ class ANFParser ( Parser ):
                 return visitor.visitChildren(self)
 
 
+    class BslContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterBsl" ):
+                listener.enterBsl(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitBsl" ):
+                listener.exitBsl(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitBsl" ):
+                return visitor.visitBsl(self)
+            else:
+                return visitor.visitChildren(self)
+
+
+    class XorContext(AexpContext):
+
+        def __init__(self, parser, ctx:ParserRuleContext): # actually a ANFParser.AexpContext
+            super().__init__(parser)
+            self.copyFrom(ctx)
+
+        def aexp(self, i:int=None):
+            if i is None:
+                return self.getTypedRuleContexts(ANFParser.AexpContext)
+            else:
+                return self.getTypedRuleContext(ANFParser.AexpContext,i)
+
+
+        def enterRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "enterXor" ):
+                listener.enterXor(self)
+
+        def exitRule(self, listener:ParseTreeListener):
+            if hasattr( listener, "exitXor" ):
+                listener.exitXor(self)
+
+        def accept(self, visitor:ParseTreeVisitor):
+            if hasattr( visitor, "visitXor" ):
+                return visitor.visitXor(self)
+            else:
+                return visitor.visitChildren(self)
+
+
 
     def aexp(self):
 
         localctx = ANFParser.AexpContext(self, self._ctx, self.state)
         self.enterRule(localctx, 0, self.RULE_aexp)
         try:
-            self.state = 38
+            self.state = 88
             self._errHandler.sync(self)
             la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
             if la_ == 1:
-                localctx = ANFParser.VarContext(self, localctx)
+                localctx = ANFParser.TrueContext(self, localctx)
                 self.enterOuterAlt(localctx, 1)
                 self.state = 6
-                self.match(ANFParser.IDENT)
+                self.match(ANFParser.T__0)
                 pass
 
             elif la_ == 2:
-                localctx = ANFParser.NumContext(self, localctx)
+                localctx = ANFParser.FalseContext(self, localctx)
                 self.enterOuterAlt(localctx, 2)
                 self.state = 7
-                self.match(ANFParser.NUMBER)
+                self.match(ANFParser.T__1)
                 pass
 
             elif la_ == 3:
-                localctx = ANFParser.AddContext(self, localctx)
+                localctx = ANFParser.VarContext(self, localctx)
                 self.enterOuterAlt(localctx, 3)
                 self.state = 8
-                self.match(ANFParser.T__0)
+                self.match(ANFParser.IDENT)
+                pass
+
+            elif la_ == 4:
+                localctx = ANFParser.NumContext(self, localctx)
+                self.enterOuterAlt(localctx, 4)
                 self.state = 9
-                self.aexp()
+                self.match(ANFParser.NUMBER)
+                pass
+
+            elif la_ == 5:
+                localctx = ANFParser.AddContext(self, localctx)
+                self.enterOuterAlt(localctx, 5)
                 self.state = 10
-                self.match(ANFParser.T__1)
+                self.match(ANFParser.T__2)
                 self.state = 11
                 self.aexp()
                 self.state = 12
-                self.match(ANFParser.T__2)
+                self.match(ANFParser.T__3)
+                self.state = 13
+                self.aexp()
+                self.state = 14
+                self.match(ANFParser.T__4)
                 pass
 
-            elif la_ == 4:
+            elif la_ == 6:
                 localctx = ANFParser.SubContext(self, localctx)
-                self.enterOuterAlt(localctx, 4)
-                self.state = 14
-                self.match(ANFParser.T__0)
-                self.state = 15
-                self.aexp()
+                self.enterOuterAlt(localctx, 6)
                 self.state = 16
-                self.match(ANFParser.T__3)
+                self.match(ANFParser.T__2)
                 self.state = 17
                 self.aexp()
                 self.state = 18
-                self.match(ANFParser.T__2)
+                self.match(ANFParser.T__5)
+                self.state = 19
+                self.aexp()
+                self.state = 20
+                self.match(ANFParser.T__4)
                 pass
 
-            elif la_ == 5:
+            elif la_ == 7:
                 localctx = ANFParser.MulContext(self, localctx)
-                self.enterOuterAlt(localctx, 5)
-                self.state = 20
-                self.match(ANFParser.T__0)
-                self.state = 21
-                self.aexp()
+                self.enterOuterAlt(localctx, 7)
                 self.state = 22
-                self.match(ANFParser.T__4)
+                self.match(ANFParser.T__2)
                 self.state = 23
                 self.aexp()
                 self.state = 24
-                self.match(ANFParser.T__2)
+                self.match(ANFParser.T__6)
+                self.state = 25
+                self.aexp()
+                self.state = 26
+                self.match(ANFParser.T__4)
                 pass
 
-            elif la_ == 6:
+            elif la_ == 8:
                 localctx = ANFParser.DivContext(self, localctx)
-                self.enterOuterAlt(localctx, 6)
-                self.state = 26
-                self.match(ANFParser.T__0)
-                self.state = 27
-                self.aexp()
+                self.enterOuterAlt(localctx, 8)
                 self.state = 28
-                self.match(ANFParser.T__5)
+                self.match(ANFParser.T__2)
                 self.state = 29
                 self.aexp()
                 self.state = 30
-                self.match(ANFParser.T__2)
+                self.match(ANFParser.T__7)
+                self.state = 31
+                self.aexp()
+                self.state = 32
+                self.match(ANFParser.T__4)
                 pass
 
-            elif la_ == 7:
-                localctx = ANFParser.LamContext(self, localctx)
-                self.enterOuterAlt(localctx, 7)
-                self.state = 32
-                self.match(ANFParser.T__0)
-                self.state = 33
-                self.match(ANFParser.IDENT)
+            elif la_ == 9:
+                localctx = ANFParser.GtContext(self, localctx)
+                self.enterOuterAlt(localctx, 9)
                 self.state = 34
-                self.match(ANFParser.T__6)
+                self.match(ANFParser.T__2)
                 self.state = 35
-                self.cexp()
+                self.aexp()
                 self.state = 36
+                self.match(ANFParser.T__8)
+                self.state = 37
+                self.aexp()
+                self.state = 38
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 10:
+                localctx = ANFParser.LtContext(self, localctx)
+                self.enterOuterAlt(localctx, 10)
+                self.state = 40
+                self.match(ANFParser.T__2)
+                self.state = 41
+                self.aexp()
+                self.state = 42
+                self.match(ANFParser.T__9)
+                self.state = 43
+                self.aexp()
+                self.state = 44
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 11:
+                localctx = ANFParser.EqContext(self, localctx)
+                self.enterOuterAlt(localctx, 11)
+                self.state = 46
+                self.match(ANFParser.T__2)
+                self.state = 47
+                self.aexp()
+                self.state = 48
+                self.match(ANFParser.T__10)
+                self.state = 49
+                self.aexp()
+                self.state = 50
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 12:
+                localctx = ANFParser.BslContext(self, localctx)
+                self.enterOuterAlt(localctx, 12)
+                self.state = 52
+                self.match(ANFParser.T__2)
+                self.state = 53
+                self.aexp()
+                self.state = 54
+                self.match(ANFParser.T__11)
+                self.state = 55
+                self.aexp()
+                self.state = 56
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 13:
+                localctx = ANFParser.BsrContext(self, localctx)
+                self.enterOuterAlt(localctx, 13)
+                self.state = 58
+                self.match(ANFParser.T__2)
+                self.state = 59
+                self.aexp()
+                self.state = 60
+                self.match(ANFParser.T__12)
+                self.state = 61
+                self.aexp()
+                self.state = 62
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 14:
+                localctx = ANFParser.AndContext(self, localctx)
+                self.enterOuterAlt(localctx, 14)
+                self.state = 64
+                self.match(ANFParser.T__2)
+                self.state = 65
+                self.aexp()
+                self.state = 66
+                self.match(ANFParser.T__13)
+                self.state = 67
+                self.aexp()
+                self.state = 68
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 15:
+                localctx = ANFParser.OrContext(self, localctx)
+                self.enterOuterAlt(localctx, 15)
+                self.state = 70
                 self.match(ANFParser.T__2)
+                self.state = 71
+                self.aexp()
+                self.state = 72
+                self.match(ANFParser.T__14)
+                self.state = 73
+                self.aexp()
+                self.state = 74
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 16:
+                localctx = ANFParser.XorContext(self, localctx)
+                self.enterOuterAlt(localctx, 16)
+                self.state = 76
+                self.match(ANFParser.T__2)
+                self.state = 77
+                self.aexp()
+                self.state = 78
+                self.match(ANFParser.T__15)
+                self.state = 79
+                self.aexp()
+                self.state = 80
+                self.match(ANFParser.T__4)
+                pass
+
+            elif la_ == 17:
+                localctx = ANFParser.LamContext(self, localctx)
+                self.enterOuterAlt(localctx, 17)
+                self.state = 82
+                self.match(ANFParser.T__2)
+                self.state = 83
+                self.match(ANFParser.IDENT)
+                self.state = 84
+                self.match(ANFParser.T__16)
+                self.state = 85
+                self.cexp()
+                self.state = 86
+                self.match(ANFParser.T__4)
                 pass
 
 
@@ -473,38 +906,38 @@ class ANFParser ( Parser ):
         self.enterRule(localctx, 2, self.RULE_funcall)
         self._la = 0 # Token type
         try:
-            self.state = 53
+            self.state = 103
             self._errHandler.sync(self)
             la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
             if la_ == 1:
                 localctx = ANFParser.CallContext(self, localctx)
                 self.enterOuterAlt(localctx, 1)
-                self.state = 40
+                self.state = 90
                 self.match(ANFParser.IDENT)
-                self.state = 41
-                self.match(ANFParser.T__0)
-                self.state = 42
+                self.state = 91
+                self.match(ANFParser.T__2)
+                self.state = 92
                 self.aexp()
-                self.state = 47
+                self.state = 97
                 self._errHandler.sync(self)
                 _la = self._input.LA(1)
-                while _la==8:
-                    self.state = 43
-                    self.match(ANFParser.T__7)
-                    self.state = 44
+                while _la==18:
+                    self.state = 93
+                    self.match(ANFParser.T__17)
+                    self.state = 94
                     self.aexp()
-                    self.state = 49
+                    self.state = 99
                     self._errHandler.sync(self)
                     _la = self._input.LA(1)
 
-                self.state = 50
-                self.match(ANFParser.T__2)
+                self.state = 100
+                self.match(ANFParser.T__4)
                 pass
 
             elif la_ == 2:
                 localctx = ANFParser.AtomContext(self, localctx)
                 self.enterOuterAlt(localctx, 2)
-                self.state = 52
+                self.state = 102
                 self.aexp()
                 pass
 
@@ -596,29 +1029,29 @@ class ANFParser ( Parser ):
         localctx = ANFParser.CexpContext(self, self._ctx, self.state)
         self.enterRule(localctx, 4, self.RULE_cexp)
         try:
-            self.state = 63
+            self.state = 113
             self._errHandler.sync(self)
             token = self._input.LA(1)
-            if token in [9]:
+            if token in [19]:
                 localctx = ANFParser.LetContext(self, localctx)
                 self.enterOuterAlt(localctx, 1)
-                self.state = 55
-                self.match(ANFParser.T__8)
-                self.state = 56
+                self.state = 105
+                self.match(ANFParser.T__18)
+                self.state = 106
                 self.match(ANFParser.IDENT)
-                self.state = 57
-                self.match(ANFParser.T__9)
-                self.state = 58
+                self.state = 107
+                self.match(ANFParser.T__19)
+                self.state = 108
                 self.funcall()
-                self.state = 59
-                self.match(ANFParser.T__10)
-                self.state = 60
+                self.state = 109
+                self.match(ANFParser.T__20)
+                self.state = 110
                 self.cexp()
                 pass
-            elif token in [1, 12, 13]:
+            elif token in [1, 2, 3, 22, 23]:
                 localctx = ANFParser.FcContext(self, localctx)
                 self.enterOuterAlt(localctx, 2)
-                self.state = 62
+                self.state = 112
                 self.funcall()
                 pass
             else: