def p_if_statement_2 ( self , p ) : p [ 0 ] = ast . If ( predicate = p [ 3 ] , consequent = p [ 5 ] , alternative = p [ 7 ] )
python ast parse if else
if_statement : IF LPAREN expr RPAREN statement ELSE statement
def p_if_statement_2(self, p):
        """if_statement : IF LPAREN expr RPAREN statement ELSE statement"""
        p[0] = ast.If(predicate=p[3], consequent=p[5], alternative=p[7])