Add way to make binary test build of user-side compiler

This commit is contained in:
John Lorentzson 2025-07-09 15:18:35 +02:00
parent 7940298753
commit 83fdb01368
3 changed files with 35 additions and 2 deletions

2
.gitignore vendored
View file

@ -5,4 +5,4 @@
*.lst
*.note
*.sh
c6lc

View file

@ -0,0 +1,32 @@
(in-package #:user-side-compiler)
(defun batch-parse-options (arguments)
(let ((options '()))
(loop :with outputp := nil
:for arg :in arguments
:do (cond (outputp
(setf (getf options :output) arg
outputp nil))
((or (string= arg "-o") (string= arg "--output"))
(setf outputp t))
((or (string= arg "-h") (string= arg "--help"))
(setf (getf options :show-help-p) t))
(t
(setf (getf options :input) arg))))
options))
(defun batch-main ()
(destructuring-bind (&key input output show-help-p)
(batch-parse-options (uiop:command-line-arguments))
(if show-help-p
(progn
(format t "Usage: c6lc [-o <output file>] <input file>~%")
(sb-ext:exit :code -1))
(batch-compile input output))))
(defun build ()
(assert (not (member :swank *features*)))
(sb-ext:save-lisp-and-die "c6lc" :toplevel #'batch-main :executable t
:save-runtime-options t
:root-structures 'batch-main
:compression t))

View file

@ -37,4 +37,5 @@
:components ((:file "value-allocator")
(:file "pre-assembly")
(:file "code-generator")))
(:file "interface")))
(:file "interface")
(:file "binary-test-build")))