From f107a40648caab71e76a7f78df3d7997d8880fb6 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 4 Aug 2015 21:36:10 -0400 Subject: [PATCH] WIP - define-syntax --- Makefile | 7 +++++++ scheme/cyclone/transforms.scm | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4cd8784c..20189b6c 100644 --- a/Makefile +++ b/Makefile @@ -139,3 +139,10 @@ uninstall: $(RMDIR) $(DESTDIR)$(DATADIR)/scheme $(RMDIR) $(DESTDIR)$(DATADIR) +trans: + sudo cp scheme/cyclone/transforms.scm /usr/local/share/cyclone/scheme/cyclone/ + cyclone scheme/cyclone/transforms.sld + sudo cp scheme/cyclone/transforms.* /usr/local/share/cyclone/scheme/cyclone/ + cyclone cyclone.scm + sudo cp cyclone /usr/local/bin/cyclone + diff --git a/scheme/cyclone/transforms.scm b/scheme/cyclone/transforms.scm index ace90b38..0b9864fb 100644 --- a/scheme/cyclone/transforms.scm +++ b/scheme/cyclone/transforms.scm @@ -913,12 +913,13 @@ ;; if found. would then want to continue expanding. may need to ;; return some value such as #t or nil as a placeholder, since the ;; define-syntax form would not be carried forward in the compiled code -; ((define-syntax? exp) ;; TODO: not good enough, should do error checking, and make sure list is big enough for cadr -; (let* ((name (cadr exp)) -; (trans (caddr exp)) -; (body (cadr trans))) -; (set! *defined-macros* (cons (cons name body) *defined-macros*)) -; #t)) + ((define-syntax? exp) ;; TODO: not good enough, should do error checking, and make sure list is big enough for cadr + (trace:info `(define-syntax ,exp)) + (let* ((name (cadr exp)) + (trans (caddr exp)) + (body (cadr trans))) + (set! *defined-macros* (cons (cons name body) *defined-macros*)) + #t)) ((macro? exp) (expand ;; Could expand into another macro (macro-expand exp)))