Created
March 14, 2018 22:24
-
-
Save vtomole/95665fa690eabd85afe28915cbc51923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun compiler (code output) | |
"Reads code file and compiles each expression into output file" | |
(let ((in (open code :if-does-not-exist nil)) (out (open output :if-does-not-exist :create :direction :output :if-exists :supersede)) | |
(instr '())) | |
(when in | |
(loop for line = (read-line in nil) | |
while line do (progn | |
(setf instr (lex-line line)) | |
(setf instr (parse instr)) | |
(gen (comp instr) out)))) | |
(close in) | |
(close out))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment