Ejemplo n.º 1
0
 def visitExp(self, ctx: BKITParser.ProgramContext):
     # exp1
     if (ctx.getChildCount() == 1):
         return ctx.exp1(0).accept(self)
     # exp1 INT_EQ exp1
     return BinaryOp(
         ctx.getChild(1).getText(),
         ctx.exp1(0).accept(self),
         ctx.exp1(1).accept(self))
Ejemplo n.º 2
0
 def visitExp1(self, ctx: BKITParser.ProgramContext):
     # exp3
     if (ctx.getChildCount() == 1):
         return ctx.exp2().accept(self)
     # exp1 AND exp2
     return BinaryOp(
         ctx.getChild(1).getText(),
         ctx.exp1().accept(self),
         ctx.exp2().accept(self))