mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added macros module
This commit is contained in:
parent
6b2891cc01
commit
d4b4bbd7fb
5 changed files with 12 additions and 47 deletions
2
Makefile
2
Makefile
|
@ -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
|
||||
|
|
|
@ -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??
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(scheme cyclone common)
|
||||
(scheme cyclone util)
|
||||
(scheme cyclone libraries)
|
||||
(scheme cyclone macros)
|
||||
)
|
||||
(export
|
||||
;*defined-macros*
|
||||
|
|
45
test2.scm
45
test2.scm
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue