Exemple #1
0
def p_unary_minus_exp(p):
    "unary_minus_exp : MINUS expression %prec UMINUS"
    p[0] = Node.OpExp(
        position=p.lineno(1),
        oper=Node.Oper.minus,
        left=Node.IntExp(position=p.lineno(1), int=0),
        right=p[2],
    )
Exemple #2
0
def p_binary_ge_exp(p):
    "binary_ge_exp : expression GE expression"
    p[0] = Node.OpExp(position=p.lineno(2), oper=Node.Oper.ge, left=p[1], right=p[3])
Exemple #3
0
def p_binary_lt_exp(p):
    "binary_lt_exp : expression LT expression"
    p[0] = Node.OpExp(position=p.lineno(2), oper=Node.Oper.lt, left=p[1], right=p[3])
Exemple #4
0
def p_binary_neq_exp(p):
    "binary_neq_exp : expression NEQ expression"
    p[0] = Node.OpExp(position=p.lineno(2), oper=Node.Oper.neq, left=p[1], right=p[3])
Exemple #5
0
def p_binary_divide_exp(p):
    "binary_divide_exp : expression DIVIDE expression"
    p[0] = Node.OpExp(
        position=p.lineno(2), oper=Node.Oper.divide, left=p[1], right=p[3]
    )
Exemple #6
0
def p_binary_times_exp(p):
    "binary_times_exp : expression TIMES expression"
    p[0] = Node.OpExp(position=p.lineno(2), oper=Node.Oper.times, left=p[1], right=p[3])
Exemple #7
0
def p_binary_minus_exp(p):
    "binary_minus_exp : expression MINUS expression"
    p[0] = Node.OpExp(position=p.lineno(2), oper=Node.Oper.minus, left=p[1], right=p[3])