From 6ffa3538cfeb5a97e967544bfbbcf907f4aa565f Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 30 Jul 2022 13:31:05 -0700 Subject: Add call-builtin syntax. This syntax allows calling opcodes directly from scheme code. Very powerful technique. --- csc/macros-test.csc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'csc/macros-test.csc') 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)))) -- cgit v1.3.1