diff options
| author | bd <bdunahu@operationnull.com> | 2025-03-20 13:51:28 -0400 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2025-03-20 13:51:28 -0400 |
| commit | 6e338215192c26dfb16236398ca8e3762a8d4d0e (patch) | |
| tree | 823d7102f43ea5a4b377d5c2cb04a5ec02fb20b7 /src/main.lisp | |
| parent | 19d13c8339ee990fba358417a54aa6f1c94c7bca (diff) | |
Add logic to open file, lex single character symbols, tests
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.lisp b/src/main.lisp index c85e392..1f0afdd 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -35,14 +35,19 @@ _/_/ _/_/ " (defun driver (cmd) "Reads in a file and directs lexing, parsing, and binary emission." (print-splash) - (let ((args (clingon:command-arguments cmd)) - (parse? (not (clingon:getopt cmd :lex))) - (emit? (not (clingon:getopt cmd :parse)))) + (let* ((args (clingon:command-arguments cmd)) + (file (car args)) + (parse? (not (clingon:getopt cmd :lex))) + (emit? (not (clingon:getopt cmd :parse)))) (cond ;; complain about num arguments ((/= (length args) 1) (error "Wrong number of arguments.")) - ((not (util:asm-extension? (car args))) (error "The file is not an asm source code file.")))) - (error-cli "Nitimur in Vetitum")) + ((not (util:asm-extension? file)) + (error "The file is not an asm source code file, or it could not be opened.")) + (t (let ((tokens (lex:file->tokens file))) + (format t "~a" tokens) + (format t "Nitimur in Vetitum~%")))))) + (defun cli/command () "Returns a clingon command." |
