aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-util.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-06-10 04:15:14 +0000
committerdos-reis <gdr@axiomatics.org>2010-06-10 04:15:14 +0000
commitf85354f7024aeb0803ddf39af67024eb6407e8fa (patch)
treee5574a05ef9a48097d8ab7d7c634d049750316da /src/interp/g-util.boot
parent065a1bd3b0facc445cccd066b47a1801abd6f0aa (diff)
downloadopen-axiom-f85354f7024aeb0803ddf39af67024eb6407e8fa.tar.gz
* interp/g-util.boot (expandLoop): Now take all arguments as a
single %loop form. (expandCollect): Adjust call. (expandRepeat): Likewise.
Diffstat (limited to 'src/interp/g-util.boot')
-rw-r--r--src/interp/g-util.boot9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 9bfb08f0..7c8945c5 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -185,7 +185,7 @@ expandIterators iters ==
it is ["%init",var,val] => expandInit(var,val)
nil
-expandLoop(iters,body,ret) ==
+expandLoop ['%loop,:iters,body,ret] ==
itersCode := expandIterators iters
itersCode = "failed" => systemErrorHere ["expandLoop",iters]
body := middleEndExpand body
@@ -215,14 +215,14 @@ expandCollect ['%collect,:iters,body] ==
-- Initialize the variable holding the result; expand as
-- if ordinary loop. But don't forget we built the result
-- in reverse order.
- expandLoop([:iters,["%init",val,nil]],body,["NREVERSE",val])
+ expandLoop ['%loop,:iters,["%init",val,nil],body,["NREVERSE",val]]
++ Generate code for plain loop.
expandRepeat ["%repeat",:iters,body] ==
- expandLoop(iters,body,["voidValue"])
+ expandLoop ['%loop,:iters,body,["voidValue"]]
expandReduce ['%reduce,:iters,val,body] ==
- expandLoop(iters,body,val)
+ expandLoop ['%loop,:iters,body,val]
expandReturn(x is ['%return,.,y]) ==
$FUNNAME = nil => systemErrorHere ['expandReturn,x]
@@ -348,6 +348,7 @@ for x in [
['%collect,:function expandCollect],
["%repeat",:function expandRepeat],
['%reduce, :function expandReduce],
+ ['%loop, :function expandLoop],
['%return, :function expandReturn],
["%eq",:function expandEq],