aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-12-04 11:03:44 +0000
committerdos-reis <gdr@axiomatics.org>2011-12-04 11:03:44 +0000
commit25235d1ab4b8841e10e62414cea75294055375f9 (patch)
treecff4841844e3c5e8c09514811f1e0f21ad9909af /src
parent7742d5b84a00366b4345d1c472c4b0f4b850a848 (diff)
downloadopen-axiom-25235d1ab4b8841e10e62414cea75294055375f9.tar.gz
* interp/g-util.boot (splitAssignments): New.
(spliceSeqArgs): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/g-util.boot11
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1898d80a..d9594223 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-04 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/g-util.boot (splitAssignments): New.
+ (spliceSeqArgs): Use it.
+
2011-12-03 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/lisp-backend.boot (hasNoExit?): New.
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 236076c0..f4f8ba00 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -68,6 +68,13 @@ mkBind(inits,expr) ==
mkBind([:inits,:inits'],expr')
['%bind,inits,expr]
+splitAssignments u == main(u,nil) where
+ main(u,l) ==
+ u is ['%LET,x,v] =>
+ v is ['%LET,y,.] => main(v,[['%LET,x,y],:l])
+ [u,:l]
+ nil
+
++ We have a list `l' of expressions to be executed sequentially.
++ Splice in any directly-embedded sequence of expressions.
++ NOTES: This function should not be called on any program with
@@ -79,6 +86,10 @@ spliceSeqArgs l ==
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
rest l = nil => l
l.rest := spliceSeqArgs rest l
l