add runner-helper

save yourself some copy-pasting why don't you?

It'd be nice if I could work out how to connect the STDIN/STDOUT for
tcc to the SBCL REPL
1 files changed, 10 insertions(+), 5 deletions(-)

M stratcom.lisp
M stratcom.lisp +10 -5
@@ 400,8 400,13 @@ 
     (setf (header e) (format nil "~a~a~%" (header e) new-code))))
 (defun compile-to-c (source-string)
-  (let* ((e (make-instance 'emitter))
-         (l (make-instance 'lexer :source source-string))
-         (p (make-instance 'parser :emitter e :lexer l)))
-    (program p)
-    (format t "~a ~a~%" (header e) (code e))))
+  (with-open-file (stream "t.c" :direction :output :if-exists :supersede)
+    (let* ((e (make-instance 'emitter))
+           (l (make-instance 'lexer :source source-string))
+           (p (make-instance 'parser :emitter e :lexer l)))
+      (program p)
+      (format stream "~a ~a~%" (header e) (code e)))))
+(defun run (strategic-communication)
+  (compile-to-c strategic-communication)
+  (uiop:run-program '("tcc" "-run" "t.c") :output t))