(newline-irx (irregex "^\n"))
(comma-irx (irregex "^,"))
(period-irx (irregex "^\\."))
- (redcode-irx (irregex "^;redcode\n"))
+ (redcode-irx (irregex "^;redcode.*\n"))
(name-start-irx (irregex "^;[ \t]*name "))
(name-irx (irregex "^[^\n]*"))
(author-start-irx (irregex "^;[ \t]*author "))
(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)
((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)