@@ -62,28 +62,22 @@ def eval_stmto(stmt, env, value, previous_args=None):
62
62
63
63
def eval_expro (expr , env , value , previous_args = None ):
64
64
print ('Evaluating expr {} to {} with env {}' .format (expr , value , env ))
65
- current_args = (expr , env , value )
66
- #if not eval_to_stack(eval_expro, current_args):
67
- if previous_args == current_args :
68
- print ('Failing on {}' .format (current_args ))
69
- return fail
70
65
71
66
op = var ('op' )
72
67
v1 = var ('v1' )
73
68
v2 = var ('v2' )
74
69
e1 = var ('e1' )
75
70
e2 = var ('e2' )
76
- for y in current_args :
77
- if isinstance (y , ast .AST ):
78
- print ('Found AST value -> {}' .format (ast .dump (y )))
71
+ if isinstance (expr , ast .AST ):
72
+ print ('Found AST for expr -> {}' .format (ast .dump (expr )))
73
+ if isinstance (value , ast .AST ):
74
+ print ('Found AST for value -> {}' .format (ast .dump (value )))
79
75
return conde (
80
76
((eq , expr , ast .Num (n = value )),
81
77
(membero , value , [0 ,1 ,2 ])),
82
78
((eq , expr , ast .BinOp (left = e1 , op = op , right = e2 )), # Expressions
83
79
(eq , op , ast .Add ()),
84
- (eval_expro , e1 , env , v1 , current_args ),
85
- (eval_expro , e2 , env , v2 , current_args ),
86
- (typeo , v1 , int ),
87
- (typeo , v2 , int ),
80
+ (eval_expro , e1 , env , v1 , None ),
81
+ (eval_expro , e2 , env , v2 , None ),
88
82
(add , v1 , v2 , value )),
89
83
)
0 commit comments