Moving common functions to util module

This commit is contained in:
Justin Ethier 2015-06-24 22:11:41 -04:00
parent 321995c914
commit e15fd3619d
4 changed files with 11 additions and 6 deletions

View file

@ -21,6 +21,9 @@ scheme/read.o: cyclone scheme/read.sld parser.scm
scheme/write.o: cyclone scheme/write.sld
./cyclone scheme/write.sld
util.so: util.scm
csc -s util.scm
transforms.so: transforms.scm
csc -s transforms.scm
@ -53,7 +56,7 @@ debug:
debug2: libcyclone.so.1
gcc test.c -L. -lcyclone -I. -g -o test
cyclone: cyclone.scm transforms.so cgen.so libraries.so parser.so libcyclone.a
cyclone: cyclone.scm transforms.so util.so cgen.so libraries.so parser.so libcyclone.a
csc cyclone.scm
.PHONY: test

View file

@ -17,6 +17,7 @@
(require-extension chicken-syntax) ;; when
(require-extension srfi-1) ;; every
(load (string-append (cyc:get-lib-dir) "parser.so"))
(load (string-append (cyc:get-lib-dir) "util.so"))
(load (string-append (cyc:get-lib-dir) "libraries.so"))
(load (string-append (cyc:get-lib-dir) "transforms.so"))
(load (string-append (cyc:get-lib-dir) "cgen.so")))
@ -26,6 +27,7 @@
; )
(else
(load (string-append (cyc:get-lib-dir) "parser.scm"))
(load (string-append (cyc:get-lib-dir) "util.scm"))
(load (string-append (cyc:get-lib-dir) "libraries.scm"))
(load (string-append (cyc:get-lib-dir) "transforms.scm"))
(load (string-append (cyc:get-lib-dir) "cgen.scm"))))

View file

@ -190,11 +190,6 @@
(define (void) (if #f #t)))
(else #f))
; tagged-list? : symbol value -> boolean
(define (tagged-list? tag l)
(and (pair? l)
(eq? tag (car l))))
; char->natural : char -> natural
(define (char->natural c)
(let ((i (char->integer c)))

5
util.scm Normal file
View file

@ -0,0 +1,5 @@
(define (tagged-list? tag exp)
(if (pair? exp)
(equal? (car exp) tag)
#f))