Esempio n. 1
0
def p_multExpr_2(p):
    '''multExpr : powerExpr STAR multExpr
                | powerExpr SLASH multExpr
                | powerExpr MODULUS multExpr
                | powerExpr REMAINDER multExpr'''
    if p[2] == 'rem':
        p[0] = sidlir.Infix_expr('mod', p[1], p[3])
    else:
        p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 2
0
def p_powerExpr_2(p):
    '''powerExpr : unaryExpr POWER powerExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 3
0
def p_addExpr_2(p):
    '''addExpr : multExpr PLUS addExpr
               | multExpr MINUS addExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 4
0
def p_relationalExpr_2(p):
    '''relationalExpr : shiftExpr LT relationalExpr
                      | shiftExpr GT relationalExpr
                      | shiftExpr LE relationalExpr
                      | shiftExpr GE relationalExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 5
0
def p_shiftExpr_2(p):
    '''shiftExpr : addExpr LSHIFT shiftExpr
                 | addExpr RSHIFT shiftExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 6
0
def p_equalityExpr_2(p):
    '''equalityExpr : relationalExpr EQ equalityExpr
                    | relationalExpr NE equalityExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 7
0
def p_bitwiseExpr_2(p):
    '''bitwiseExpr : equalityExpr BITWISE_AND bitwiseExpr
                   | equalityExpr BITWISE_OR bitwiseExpr
                   | equalityExpr BITWISE_XOR bitwiseExpr'''
    p[0] = sidlir.Infix_expr(p[2], p[1], p[3])
Esempio n. 8
0
def p_andExpr_2(p):
    '''andExpr : bitwiseExpr LOGICAL_AND andExpr'''
    p[0] = sidlir.Infix_expr('log_' + str.lower(p[2]), p[1], p[3])
Esempio n. 9
0
def p_orExpr_2(p):
    '''orExpr : andExpr LOGICAL_OR orExpr
              | andExpr LOGICAL_XOR orExpr'''
    p[0] = sidlir.Infix_expr('log_' + str.lower(p[2]), p[1], p[3])
Esempio n. 10
0
def p_assertExpr_2(p):
    '''assertExpr : orExpr IMPLIES orExpr
                  | orExpr IFF orExpr'''
    p[0] = sidlir.Infix_expr(str.lower(p[2]), p[1], p[3])