mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +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/cgen \
|
||||||
scheme/cyclone/common \
|
scheme/cyclone/common \
|
||||||
scheme/cyclone/libraries \
|
scheme/cyclone/libraries \
|
||||||
|
scheme/cyclone/macros \
|
||||||
scheme/cyclone/transforms \
|
scheme/cyclone/transforms \
|
||||||
scheme/cyclone/util
|
scheme/cyclone/util
|
||||||
SLDFILES = $(addsuffix .sld, $(SMODULES))
|
SLDFILES = $(addsuffix .sld, $(SMODULES))
|
||||||
|
@ -78,6 +79,7 @@ bootstrap: icyc
|
||||||
cp icyc.scm $(BOOTSTRAP_DIR)
|
cp icyc.scm $(BOOTSTRAP_DIR)
|
||||||
cp tests/unit-tests.scm $(BOOTSTRAP_DIR)
|
cp tests/unit-tests.scm $(BOOTSTRAP_DIR)
|
||||||
cp scheme/cyclone/libraries.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
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/transforms.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
||||||
cp scheme/cyclone/cgen.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
cp scheme/cyclone/cgen.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
||||||
cp scheme/cyclone/util.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
cp scheme/cyclone/util.c $(BOOTSTRAP_DIR)/scheme/cyclone
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
;; Macro section
|
;; Macro section
|
||||||
;; TODO: place this in another module? could speed development
|
;; TODO: place this in another module? could speed development
|
||||||
(define (define-syntax? exp)
|
(define (define-syntax? exp)
|
||||||
(tagged-list 'define-syntax exp))
|
(tagged-list? 'define-syntax exp))
|
||||||
|
|
||||||
; TODO: get macro name, transformer
|
; TODO: get macro name, transformer
|
||||||
; TODO: base off of syntactic closures instead of ER macros??
|
; TODO: base off of syntactic closures instead of ER macros??
|
||||||
|
|
|
@ -14,15 +14,6 @@
|
||||||
(else
|
(else
|
||||||
#f))
|
#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
|
;; Built-in macros
|
||||||
;; TODO: just a stub, real code would read (define-syntax)
|
;; TODO: just a stub, real code would read (define-syntax)
|
||||||
;; from a lib file or such
|
;; from a lib file or such
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
(scheme cyclone common)
|
(scheme cyclone common)
|
||||||
(scheme cyclone util)
|
(scheme cyclone util)
|
||||||
(scheme cyclone libraries)
|
(scheme cyclone libraries)
|
||||||
|
(scheme cyclone macros)
|
||||||
)
|
)
|
||||||
(export
|
(export
|
||||||
;*defined-macros*
|
;*defined-macros*
|
||||||
|
|
45
test2.scm
45
test2.scm
|
@ -1,40 +1,11 @@
|
||||||
(import (scheme base)
|
(import (scheme base)
|
||||||
(scheme file)
|
|
||||||
(scheme write))
|
(scheme write))
|
||||||
|
|
||||||
(define fp (open-input-file "test.scm"))
|
(define-syntax test
|
||||||
(write (Cyc-read-line fp))
|
(er-macro-transformer
|
||||||
(write
|
(lambda (expr rename compare)
|
||||||
(string-set! "abc" 1 #\x))
|
(write "testing")
|
||||||
;
|
(write expr))))
|
||||||
;(map
|
|
||||||
; (lambda (_)
|
(test 1 2 3)
|
||||||
;(set! x 1)
|
(test 'done)
|
||||||
;;(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))
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue