diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-29 17:03:03 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-29 17:03:03 -0700 |
| commit | 8fc3997b73e98416f64b78f2814711b6d1439755 (patch) | |
| tree | 84d534f5eac2bd4e87c8930b065dd3ad2ab20c1d /csc/main.csc | |
| parent | Fix some compilation errors in the compiler. (diff) | |
| download | chromatopelma-8fc3997b73e98416f64b78f2814711b6d1439755.tar.zst | |
Fig bugs in the flag library.
Now bool flags are handled properly. We have a compiler!!
Diffstat (limited to 'csc/main.csc')
| -rw-r--r-- | csc/main.csc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/csc/main.csc b/csc/main.csc index 1e2cde1..9dae75f 100644 --- a/csc/main.csc +++ b/csc/main.csc @@ -1,4 +1,6 @@ (import (scheme base) + (only (scheme file) + open-binary-output-file) (only (scheme read) read) (only (csc compiler) @@ -23,6 +25,7 @@ (define-flag *include* "include" (lambda (s) (cons s *include*)) '()) (define-flag *output* "output" string-copy "") (define-flag *help* "help" bool-flag #f) +(define-flag *h* "h" bool-flag #f) (define *help-msg* @@ -32,6 +35,8 @@ This flag can be passed more than once. --output FILE Write output to the given file. The default is to immediately execute. + + --help,-h Print the usage message. ") @@ -54,7 +59,7 @@ (printf "Error: could not parse flag {}: {}\n{}" (parse-error-flag e) (parse-error-msg e) *help-msg*) (exit 2))) (parse-flags)) - (when *help* + (when (or *help* *h*) (printf "{}" *help-msg*) (exit 0)) (when (string=? "" *output*) @@ -66,3 +71,6 @@ (exit 2)))) (set! *library-search-dirs* *include*) (write-file *output* (compile (read-file input-file)))) + + +(main) |
