Added macros module

This commit is contained in:
Justin Ethier 2015-08-04 21:48:26 -04:00
parent 6b2891cc01
commit d4b4bbd7fb
5 changed files with 12 additions and 47 deletions

View file

@ -19,6 +19,7 @@ SMODULES = \
scheme/cyclone/cgen \
scheme/cyclone/common \
scheme/cyclone/libraries \
scheme/cyclone/macros \
scheme/cyclone/transforms \
scheme/cyclone/util
SLDFILES = $(addsuffix .sld, $(SMODULES))
@ -78,6 +79,7 @@ bootstrap: icyc
cp icyc.scm $(BOOTSTRAP_DIR)
cp tests/unit-tests.scm $(BOOTSTRAP_DIR)
cp scheme/cyclone/libraries.c $(BOOTSTRAP_DIR)/scheme/cyclone
cp scheme/cyclone/macros.c $(BOOTSTRAP_DIR)/scheme/cyclone
cp scheme/cyclone/transforms.c $(BOOTSTRAP_DIR)/scheme/cyclone
cp scheme/cyclone/cgen.c $(BOOTSTRAP_DIR)/scheme/cyclone
cp scheme/cyclone/util.c $(BOOTSTRAP_DIR)/scheme/cyclone

View file

@ -9,7 +9,7 @@
;; Macro section
;; TODO: place this in another module? could speed development
(define (define-syntax? exp)
(tagged-list 'define-syntax exp))
(tagged-list? 'define-syntax exp))
; TODO: get macro name, transformer
; TODO: base off of syntactic closures instead of ER macros??

View file

@ -14,15 +14,6 @@
(else
#f))
;; Macro section
;; TODO: place this in another module? could speed development
(define (define-syntax? exp)
(tagged-list 'define-syntax exp))
; TODO: get macro name, transformer
; TODO: base off of syntactic closures instead of ER macros??
; TODO: let-syntax forms
;; Built-in macros
;; TODO: just a stub, real code would read (define-syntax)
;; from a lib file or such

View file

@ -8,6 +8,7 @@
(scheme cyclone common)
(scheme cyclone util)
(scheme cyclone libraries)
(scheme cyclone macros)
)
(export
;*defined-macros*

View file

@ -1,40 +1,11 @@
(import (scheme base)
(scheme file)
(scheme write))
(define fp (open-input-file "test.scm"))
(write (Cyc-read-line fp))
(write
(string-set! "abc" 1 #\x))
;
;(map
; (lambda (_)
;(set! x 1)
;;(write x)
;;(write 'Cyc_procedure)
;(open-input-file "1.scm")
;)
;(list 1))
;;; TODO: C macros for funcall1, etc are not being generated even though entries are set
;;; in the vector. must be another problem inspecting the vector ???
;(write 'hello)
;(let loop ((i 10))
; (if (zero? i)
; (write 'done)
; (loop (- i 1))))
;
;
;(write (command-line-arguments))
;
;(write (when (lambda () #t) 'true))
;(write (when (lambda () #f) 'false))
;
;; Need to fix this up at some point:
;;
;; Lambda application is broken with pure varargs
;; TODO: once this works, add it to test suite!!!
;((lambda test (write test)) 1 2 3 4)
;
;;; This is OK
;;(define test (lambda args args))
;;(write (test 1 2 3 4))
(define-syntax test
(er-macro-transformer
(lambda (expr rename compare)
(write "testing")
(write expr))))
(test 1 2 3)
(test 'done)