added ops for C codegen
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
(collect (read-line str)))
|
||||
(t (finish)))))))
|
||||
|
||||
(defun run-test (path)
|
||||
(defun run-test (path &key (target :nasm))
|
||||
"File must begin with 2 comments:
|
||||
First must be TEST
|
||||
Second must eval to the expected result"
|
||||
@@ -49,8 +49,11 @@
|
||||
(return-from run-test 'not-test))
|
||||
(let ((expected-output (eval (read-form-comment str))))
|
||||
(generate-program (parse-tokens (lex-stream str))
|
||||
:path (change-file-type abs-path "asm")
|
||||
:compile t :silence t)
|
||||
:path (change-file-type abs-path (case target
|
||||
(:nasm "asm")
|
||||
(:c "c")))
|
||||
:compile t :silence t
|
||||
:target target)
|
||||
(let ((output (run (list (drop-file-type abs-path))
|
||||
:output :string :silence t)))
|
||||
(format t "testing ~a... " (pathname-name path))
|
||||
|
||||
Reference in New Issue
Block a user