Exemplo n.º 1
0
 def visitExp3(self, ctx: BKITParser.ProgramContext):
     # right association should be calced first ?
     if (ctx.getChildCount() == 1):
         return ctx.exp4().accept(self)
     return BinaryOp(
         ctx.getChild(1).getText(),
         ctx.exp3().accept(self),
         ctx.exp4().accept(self))
Exemplo n.º 2
0
 def visitExp4(self, ctx: BKITParser.ProgramContext):
     if (ctx.getChildCount() == 1):
         return ctx.exp5().accept(self)
         # return UnaryOp("[]", ArrayCell(None, [IntLiteral(value=34)]))
     return UnaryOp(ctx.getChild(0).getText(), ctx.exp4().accept(self))