The Lambda Lab
/
projects
/
jars.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bebac0e
)
Added parse error on empty program.
master
author
plugd
<plugd@thelambdalab.xyz>
Thu, 9 Mar 2023 14:04:19 +0000
(15:04 +0100)
committer
plugd
<plugd@thelambdalab.xyz>
Thu, 9 Mar 2023 14:04:19 +0000
(15:04 +0100)
parser.scm
patch
|
blob
|
history
diff --git
a/parser.scm
b/parser.scm
index
c112cf9
..
b075e5a
100644
(file)
--- a/
parser.scm
+++ b/
parser.scm
@@
-75,8
+75,8
@@
(accept-token redcode-irx #t)
(let loop ((instrs '())
(offset 0)
(accept-token redcode-irx #t)
(let loop ((instrs '())
(offset 0)
- (name
'()
)
- (author
'()))
+ (name
#f
)
+ (author
"Unspecified"))
(let ((this-line (line)))
(if this-line
(case (car this-line)
(let ((this-line (line)))
(if this-line
(case (car this-line)
@@
-85,7
+85,10
@@
((comment) (loop instrs offset name author))
((org) (loop instrs (cdr this-line) name author))
((instr) (loop (cons (cdr this-line) instrs) offset name author)))
((comment) (loop instrs offset name author))
((org) (loop instrs (cdr this-line) name author))
((instr) (loop (cons (cdr this-line) instrs) offset name author)))
- (make-prog name author (reverse instrs) offset)))))
+ (begin
+ (if (and name (not (null? instrs)))
+ (make-prog name author (reverse instrs) offset)
+ (error "Failed to parse name and/or instructions")))))))
(define (line)
(or (name-line)
(define (line)
(or (name-line)