예제 #1
0
def p_exp_lt(p):
    '''exp : exp '<' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.LT, p[1], p[3], p.lineno(2))
예제 #2
0
def p_exp_gt(p):
    '''exp : exp '>' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.GT, p[1], p[3], p.lineno(2))
예제 #3
0
def p_exp_div(p):
    '''exp : exp '/' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.DIV, p[1], p[3], p.lineno(2))
예제 #4
0
def p_exp_mod(p):
    '''exp : exp '%' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.MOD, p[1], p[3], p.lineno(2))
예제 #5
0
def p_exp_mult(p):
    '''exp : exp '*' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.MULT, p[1], p[3], p.lineno(2))
예제 #6
0
def p_exp_minus(p):
    '''exp : exp '-' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.MINUS, p[1], p[3], p.lineno(2))
예제 #7
0
def p_exp_plus(p):
    '''exp : exp '+' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.PLUS, p[1], p[3], p.lineno(2))
예제 #8
0
def p_exp_eq(p):
    '''exp : exp '=' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.EQ, p[1], p[3], p.lineno(2))
예제 #9
0
def p_exp_seq(p):
    '''exp : exp ',' exp'''
    p[0] = ast.BinOpExp(ast.BinOpExp.COMMA, p[1], p[3], p.lineno(2))