Skip to content

Instantly share code, notes, and snippets.

@vtomole
Created March 14, 2018 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vtomole/95665fa690eabd85afe28915cbc51923 to your computer and use it in GitHub Desktop.
Save vtomole/95665fa690eabd85afe28915cbc51923 to your computer and use it in GitHub Desktop.
(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