diff --git a/Makefile b/Makefile index d93635bc..dd82b324 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ TESTSCM = unit-tests TESTFILES = $(addprefix tests/, $(addsuffix .scm, $(TESTSCM))) -all: cyclone icyc +all: cyclone scheme/base.o scheme/read.o icyc + +scheme/base.o: cyclone scheme/base.sld + ./cyclone scheme/base.sld + +scheme/read.o: cyclone scheme/read.sld + ./cyclone scheme/read.sld trans.so: trans.scm csc -s trans.scm @@ -39,28 +45,28 @@ cyclone: cyclone.scm trans.so cgen.so parser.so libcyclone.a test: $(TESTFILES) cyclone $(foreach f,$(TESTSCM), echo tests/$(f) ; ./cyclone tests/$(f).scm && tests/$(f) && rm -rf tests/$(f);) -############################## -# Temporary testing directives -.PHONY: test2 -test2: examples/hello-library/int-test/hello.c libcyclone.a - ./cyclone scheme/base.sld - cd examples/hello-library ; ../../cyclone libs/lib1.sld - cd examples/hello-library ; ../../cyclone libs/lib2.sld - cd examples/hello-library ; ../../cyclone hello.scm -# gcc examples/hello-library/int-test/lib2.c -I. -g -c -o lib2.o -# gcc examples/hello-library/int-test/hello.c -I. -g -c -o hello.o -# gcc hello.o lib2.o -L. -lcyclone -lm -o hello -# gcc examples/hello-library/hello.c -L. -lcyclone -lm -I. -g -o hello -# TODO: will need to manually compile hello example. need to manually add the entry points to hello, and there is an issue in the libs with Cyc_global_vars not being assigned. but this still leads to a tag error so there must be other issues... -.PHONY: test3 -test3: - gcc examples/hello-library/int-test/scheme/base.c -I/home/justin/Documents/cyclone/ -g -c -o scheme/base.o - cd examples/hello-library ; gcc int-test/libs/lib1.c -I/home/justin/Documents/cyclone/ -g -c -o libs/lib1.o - cd examples/hello-library ; gcc int-test/libs/lib2.c -I/home/justin/Documents/cyclone/ -g -c -o libs/lib2.o - cd examples/hello-library ; gcc int-test/hello.c -I/home/justin/Documents/cyclone/ -g -c -o hello.o - cd examples/hello-library ; gcc hello.o libs/lib1.o /home/justin/Documents/cyclone/scheme/base.o libs/lib2.o -L/home/justin/Documents/cyclone/ -lcyclone -lm -I/home/justin/Documents/cyclone/ -g -o hello -# END temporary directives -########################## +############################### +## Temporary testing directives +#.PHONY: test2 +#test2: examples/hello-library/int-test/hello.c libcyclone.a +# ./cyclone scheme/base.sld +# cd examples/hello-library ; ../../cyclone libs/lib1.sld +# cd examples/hello-library ; ../../cyclone libs/lib2.sld +# cd examples/hello-library ; ../../cyclone hello.scm +## gcc examples/hello-library/int-test/lib2.c -I. -g -c -o lib2.o +## gcc examples/hello-library/int-test/hello.c -I. -g -c -o hello.o +## gcc hello.o lib2.o -L. -lcyclone -lm -o hello +## gcc examples/hello-library/hello.c -L. -lcyclone -lm -I. -g -o hello +## TODO: will need to manually compile hello example. need to manually add the entry points to hello, and there is an issue in the libs with Cyc_global_vars not being assigned. but this still leads to a tag error so there must be other issues... +#.PHONY: test3 +#test3: +# gcc examples/hello-library/int-test/scheme/base.c -I/home/justin/Documents/cyclone/ -g -c -o scheme/base.o +# cd examples/hello-library ; gcc int-test/libs/lib1.c -I/home/justin/Documents/cyclone/ -g -c -o libs/lib1.o +# cd examples/hello-library ; gcc int-test/libs/lib2.c -I/home/justin/Documents/cyclone/ -g -c -o libs/lib2.o +# cd examples/hello-library ; gcc int-test/hello.c -I/home/justin/Documents/cyclone/ -g -c -o hello.o +# cd examples/hello-library ; gcc hello.o libs/lib1.o /home/justin/Documents/cyclone/scheme/base.o libs/lib2.o -L/home/justin/Documents/cyclone/ -lcyclone -lm -I/home/justin/Documents/cyclone/ -g -o hello +## END temporary directives +########################### icyc: cyclone icyc.scm eval.scm parser.scm runtime.h ./cyclone icyc.scm diff --git a/cyclone.scm b/cyclone.scm index 1d381a93..fee67d36 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -240,11 +240,11 @@ (if (member 'eval result) (read-file (get-lib "eval.scm")) '()) - (if (member 'read result) - (append - (read-file (get-lib "parser.scm")) - '((define read cyc-read))) - '()) + ;(if (member 'read result) + ; (append + ; (read-file (get-lib "parser.scm")) + ; '((define read cyc-read))) + ; '()) in-prog))) (create-c-file program)))) ;; TODO: no, don't do same work twice. real answer is linking diff --git a/scheme/read.sld b/scheme/read.sld index 8310117f..dbd5c3d4 100644 --- a/scheme/read.sld +++ b/scheme/read.sld @@ -5,5 +5,5 @@ cyc-read ;; try this first, but it needs to go away!!! read-all ) - (include "parser.scm") + (include "../parser.scm") (begin)) diff --git a/test.scm b/test.scm index 2c9d577e..398f62a1 100644 --- a/test.scm +++ b/test.scm @@ -1,37 +1,3 @@ -(define (eval2 exp . env) - exp) - -(define (test) - (call/cc - (lambda (k) - (write (list 'result - (with-exception-handler - (lambda (obj) - (display "Error: ") - (cond - ((pair? obj) - (for-each - (lambda (o) - (display o) - (display " ")) - obj)) - (else - (display obj))) - (display "\n") - (k #t)) - (lambda () - (repl)))))))) -(define (repl) - (display "cyclone> ") - ;(let ((c 'done)) ;(read)))) ;; fine with this line - (let ((c (eval2 'done))) ;(read)))) ;; Crashes with this line - ;(let ((c (read))) - (cond - ((not (eof-object? c)) - (write c) - ;(test) - ) - (else - (exit 0) ;; TODO: crashes on this branch... WTF? - )))) -(test) +(import (scheme base) + (scheme read)) +(write (read))