aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/g-opt.boot14
-rw-r--r--src/interp/g-util.boot5
3 files changed, 20 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4597a6f3..166df8c5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-05 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/g-opt.boot (changeVariableDefinitionToStore): Separately
+ handle %bind and LET forms.
+ * interp/g-util.boot (spliceSeqArgs): Recurse into %seq forms.
+
2011-12-04 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/compiler.boot (freeVarUsage): Handle %bind and LET.
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 5299fc74..d5eaa8be 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -115,7 +115,7 @@ changeVariableDefinitionToStore(form,vars) ==
changeVariableDefinitionToStore(s1,vars')
changeVariableDefinitionToStore(s2,vars')
vars
- form.op is '%when =>
+ form is ['%when,:.] =>
for clause in form.args repeat
-- variable defined in clause predicates are visible
-- in subsequent predicates. See the case for IF forms.
@@ -123,14 +123,22 @@ changeVariableDefinitionToStore(form,vars) ==
-- but those defined in branches are local.
changeVariableDefinitionToStore(rest clause,vars)
vars
- -- local bindings are, well, local.
- form.op in '(%bind LET) =>
+ -- recursive binding
+ form is ['%bind,:.] =>
vars' := vars
for [v,init] in second form repeat
vars' := changeVariableDefinitionToStore(init,vars')
vars' := [v,:vars']
changeVariableDefinitionToStore(third form,vars')
vars
+ -- non-recursive binding.
+ form is ['LET,:.] =>
+ vars' := nil
+ for [v,init] in second form repeat
+ changeVariableDefinitionToStore(init,vars')
+ vars' := [v,:vars']
+ changeVariableDefinitionToStore(third form,[:vars',:vars])
+ vars
ident? form.op and abstractionOperator? form.op =>
changeVariableDefinitionToStore(form.absBody,[:form.absParms,:vars])
vars
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index f4f8ba00..437c0427 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -82,11 +82,12 @@ splitAssignments u == main(u,nil) where
++ (if at all) before any call to simplifyVMForm.
spliceSeqArgs l ==
atomic? l => l
- l is [['%seq,:stmts],:.] =>
+ s := first l
+ s is ['%seq,:.] =>
+ stmts := spliceSeqArgs s.args
stmts = nil => spliceSeqArgs rest l
lastNode(stmts).rest := spliceSeqArgs rest l
stmts
- s := first l
s is ['%LET,x,y] and (stmts := splitAssignments y) =>
lastNode(stmts).rest := [['%LET,x,second y],:spliceSeqArgs rest l]
stmts