@@ 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))