aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-05-28 19:37:58 +0000
committerdos-reis <gdr@axiomatics.org>2010-05-28 19:37:58 +0000
commit0e1d7b240d69f6c332b27faeca503589139791ab (patch)
treebf40619f3c8243262e83006122a04f047a279ede /src
parent107ed7e85c68091c926d82ea6fd90dfa4a55398e (diff)
downloadopen-axiom-0e1d7b240d69f6c332b27faeca503589139791ab.tar.gz
More opcode expanders
Diffstat (limited to 'src')
-rw-r--r--src/interp/g-util.boot33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 45b43dc8..18af0463 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -192,6 +192,13 @@ expandOr ["%or",:args] ==
["OR",:expandToVMForm args]
-- Arithmetic operations
+
+expandIabs ["%iabs",arg] ==
+ ["ABS",expandToVMForm arg]
+
+expandIexp ["%iexp",:args] ==
+ ["EXPT",:expandToVMForm args]
+
expandImul ["%imul",:args] ==
["*",:expandToVMForm args]
@@ -204,6 +211,15 @@ expandIsub ["%isub",:args] ==
expandIeq ["%ieq",:args] ==
["EQL",:expandToVMForm args]
+expandImin ["%imin",:args] ==
+ ["MIN",:expandToVMForm args]
+
+expandImax ["%imax",:args] ==
+ ["MAX",:expandToVMForm args]
+
+expandIgcd ["%igcd",:args] ==
+ ["GCD",:expandToVMForm args]
+
-- Local variable bindings
expandBind ["%bind",inits,body] ==
body := expandToVMForm body
@@ -222,6 +238,15 @@ expandStore ["%store",place,value] ==
cons? place => ["SETF",place,value]
["SETQ",place,value]
+-- List operators
+
+expandHead ["%head",x] ==
+ ["CAR",expandToVMForm x]
+
+expandTail ["%tail",x] ==
+ ["CDR",expandToVMForm x]
+
+
++ Table of opcode-expander pairs.
for x in [
["%not",:function expandNot],
@@ -236,12 +261,20 @@ for x in [
["%ge",:function expandGreaterEqual],
["%gt",:function expandGreater],
+ ["%iabs",:function expandIabs],
["%imul",:function expandImul],
+ ["%iexp",:function expandIexp],
["%iadd",:function expandIadd],
["%isub",:function expandIsub],
+ ["%imin",:function expandImin],
+ ["%imax",:function expandImax],
+ ["%igcd",:function expandIgcd],
["%ieq",:function expandIeq],
+ ["%head",:function expandHead],
+ ["%tail",:function expandTail],
+
["%bind",:function expandBind],
["%store",:function expandStore],
["%dynval",:function expandDynval]