aboutsummaryrefslogtreecommitdiffstats
path: root/test.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-12-31 13:00:56 -0500
committerGravatar Peter McGoron 2024-12-31 13:00:56 -0500
commit4ed25b5f56d2746aa33386c55dfe920abb7c282b (patch)
tree14149a34b9f7eeadc0c039a3d43a61182a52e7a0 /test.scm
start cps translator
Diffstat (limited to 'test.scm')
-rw-r--r--test.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/test.scm b/test.scm
new file mode 100644
index 0000000..b2ea9e5
--- /dev/null
+++ b/test.scm
@@ -0,0 +1,33 @@
+(load "gamma-scheme.cps.sld")
+(import (gamma-scheme cps) test)
+
+(define (wnl x)
+ (write (cps->sexpr (core->cps x)))
+ (newline))
+
+#;(wnl (cps->sexpr cps:with-sub-kont))
+
+(test "constant"
+ '(pass (5) () __toplevel)
+ (cps->sexpr (core->cps 5)))
+
+(test "symbol"
+ '(pass (x) () __toplevel)
+ (cps->sexpr (core->cps 'x)))
+
+(test "thunk"
+ '(apply x () () __toplevel)
+ (cps->sexpr (core->cps '(x))))
+
+(test "one symbol arg"
+ '(apply x (y) () __toplevel)
+ (cps->sexpr (core->cps '(x y))))
+
+(test "one constant arg"
+ '(apply x (5) () __toplevel)
+ (cps->sexpr (core->cps '(x 5))))
+
+(test "one compound arg"
+ '(apply f (x) () (kappa (__v2) __γ1 (apply x (__v2) __γ1 __toplevel)))
+ (cps->sexpr (core->cps '(x (f x)))))
+