aboutsummaryrefslogtreecommitdiff
path: root/src/boot/translator.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-02-04 01:16:51 +0000
committerdos-reis <gdr@axiomatics.org>2008-02-04 01:16:51 +0000
commitd5088a15f1073ad01d8be9de9d4b6242dd5ed426 (patch)
treedafb8c5e145b623eb60ed1a3b2f424bb7861dfbf /src/boot/translator.boot
parentcc79332bf2ba63c453df4a9f71870a7adf4fa4a3 (diff)
downloadopen-axiom-d5088a15f1073ad01d8be9de9d4b6242dd5ed426.tar.gz
* boot/translator.boot (translateToplevelExpression): New.
(bpOutItem): Use it. * boot/ast.boot (needsPROG): New. (shoeCompTran): Use it. Tidy. (bfMain): Define cache variables before functions manipulating them. * boot/strap/: Update cached Lisp translations. * interp/g-timer.boot: Use assignment instead of SETANDFILEQ at toplevel. * interp/i-syscmd.boot: Likewise. * interp/pf2atree.boot: Likewise. * interp/trace.boot: Likewise.
Diffstat (limited to 'src/boot/translator.boot')
-rw-r--r--src/boot/translator.boot17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index cabf8d5a..f8adef8b 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -360,6 +360,20 @@ genDeclaration(n,t) ==
["DECLAIM",["FTYPE",["FUNCTION",argTypes,valType],n]]
["DECLAIM",["TYPE",t,n]]
+
+++ A non declarative expression `expr' appears at toplevel and its
+++ translation needs embeddeding in an `EVAL-WHEN'.
+translateToplevelExpression expr ==
+ expr' := rest rest shoeCompTran ["LAMBDA",["x"],expr]
+ -- replace "DECLARE"s with "DECLAIM"s, as the former can't appear
+ -- at toplevel.
+ for t in expr' repeat
+ t is ["DECLARE",:.] =>
+ RPLACA(t,"DECLAIM")
+ shoeEVALANDFILEACTQ
+ #expr' > 1 => ["PROGN",:expr']
+ first expr'
+
bpOutItem()==
$op := nil
bpComma() or bpTrap()
@@ -388,8 +402,7 @@ bpOutItem()==
bpPush [["DEFCONSTANT", n, e]]
otherwise =>
- b:=shoeCompTran ["LAMBDA",["x"],b]
- bpPush [shoeEVALANDFILEACTQ CADDR b]
+ bpPush [translateToplevelExpression b]
--shoeStartsAt (sz,name,stream)==
-- bStreamNull stream => ['nullstream]