diff --git a/smop/main.py b/smop/main.py index 99327fda..13d29a17 100644 --- a/smop/main.py +++ b/smop/main.py @@ -99,7 +99,7 @@ def main(): if options.execfile: execfile(f) except: - if options.delete-on-error: + if options.delete_on_error: os.unlink(f) if options.verbose: print "Removed",f diff --git a/smop/resolve.pl b/smop/resolve.pl index fd02d3c4..2ad89270 100644 --- a/smop/resolve.pl +++ b/smop/resolve.pl @@ -13,11 +13,34 @@ let(a, ai), let(mv, [])]). +% TODO +% 0. Copy state of is_def/is_ref --> resolve statements +% 4, const rank shape +% 6. SSA +% 8. Macroexpand +% 10. parser +% 12. backend +do_resolve(A) :- + retractall(is_def), + retractall(is_ref), + resolve(A). + +is_unused(A) :- + is_def(A), + \+ is_ref(A). + +is_arrayref(A) :- + is_def(A). + +is_funcall(A) :- + is_ref(A), + \+ is_def. + resolve(A) :- atom(A), !, - writeln(A). - %assertz(is_ref(A)). + writeln(A), + assertz(is_ref(A)). resolve(A) :- number(A), @@ -50,8 +73,8 @@ lhs_resolve(A) :- % A=... atom(A), !, - writeln(A). -% assertz(is_def(A)). + writeln(A), + assertz(is_def(A)). %lhs_resolve(A) :- % number(A).