[racket] macro expansion function in Scheme
Ciao a tutti,
I'm looking for a Scheme function that can perform macro expansion on a
quoted expression. I bet someone has implemented such a thing before,
but I can't find it. Maybe someone can point me in the right direction?
For example, I'm looking for something that works along the following lines:
; example of syntax (from R5RS)
(define or-syntax
'(define-syntax or
(syntax-rules ()
((or) #f)
((or test) test)
((or test1 test2 ...)
(let ((x test1)) (if x x (or test2 ...)))))))
; gather all quoted define-syntax expressions here
(define *syntax*
(list or-syntax #;...))
; the function I'm looking for
(define (expand-macro expr syntax-lst)
??)
And then it could work like this:
> (expand-macro '(or x y) *syntax*)
(let ((g42 x)) (if g42 g42 y))
Best regards,
Bas