예제 #1
0
 def p_bin_expressions(self, p):
     """
     expression : expression PLUS expression
                | expression MINUS expression
                | expression TIMES expression
                | expression DIVIDE expression
                | expression MPLUS expression
                | expression MMINUS expression
                | expression MTIMES expression
                | expression MDIVIDE expression
     """
     p[0] = ast.BinaryExpression(p[1], p[2], p[3])
예제 #2
0
 def p_relation(self, p):
     """relation : expression logic_operator expression"""
     p[0] = ast.BinaryExpression(p[1], p[2], p[3])