aboutsummaryrefslogtreecommitdiffstats
path: root/csc/macros-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-07-30 13:31:05 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-07-30 13:31:19 -0700
commit6ffa3538cfeb5a97e967544bfbbcf907f4aa565f (patch)
tree691d7b73e47c8c07acbf3fef5cee11d76bb34a52 /csc/macros-test.csc
parent0632650d0e4250e08a76982ab2713a34e3531b33 (diff)
downloadchromatopelma-6ffa3538cfeb5a97e967544bfbbcf907f4aa565f.tar.zst
Add call-builtin syntax.
This syntax allows calling opcodes directly from scheme code. Very powerful technique.
Diffstat (limited to 'csc/macros-test.csc')
-rw-r--r--csc/macros-test.csc13
1 files changed, 13 insertions, 0 deletions
diff --git a/csc/macros-test.csc b/csc/macros-test.csc
index 6ee0596..531e3e2 100644
--- a/csc/macros-test.csc
+++ b/csc/macros-test.csc
@@ -5,6 +5,7 @@
gensym?)
(only (csc ir1)
%call
+ %call-builtin
%constant
%define-syntax
%if
@@ -15,6 +16,7 @@
%library-define
%library-ref
%sequence
+ call-builtin?
call?
constant?
define-syntax?
@@ -27,6 +29,7 @@
lexical-set?
library-define?
library-ref?
+ make-call-builtin
make-constant
make-define-syntax
make-lambda
@@ -52,6 +55,7 @@
(cons define-syntax? %define-syntax)
(cons if? %if)
(cons call? %call)
+ (cons call-builtin? %call-builtin)
(cons sequence? %sequence)
(cons lambda? %lambda)
(cons letrec? %letrec)
@@ -278,4 +282,13 @@
((five _) 5)))
(five 6))
builtins-environment)
+ transform-ir1))
+
+
+ (test builtin-call-builtin
+ (assert-equal
+ (make-call-builtin 'bbb (list (make-constant 5)))
+ (expand-body 'main
+ '((call-builtin bbb 5))
+ builtins-environment)
transform-ir1))))