aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]