acc is never assigned to...

D'oh!
This commit is contained in:
Simon Forman 2024-04-09 12:30:50 -07:00
parent d44c33f397
commit da1426ed8d
1 changed files with 3 additions and 5 deletions

View File

@ -196,13 +196,11 @@
(define (tokenize str) ; Let's do the simple trick. (define (tokenize str) ; Let's do the simple trick.
(string-split (string-replace (string-replace str "]" " ] ") "[" " [ "))) (string-split (string-replace (string-replace str "]" " ] ") "[" " [ ")))
(define (parse tokens) (parse0 tokens '())) (define (parse tokens)
(if (null? tokens) '()
(define (parse0 tokens acc)
(if (null? tokens) acc
(receive (term rest_of_tokens) (receive (term rest_of_tokens)
(one-token-lookahead (car tokens) (cdr tokens)) (one-token-lookahead (car tokens) (cdr tokens))
(cons term (parse0 rest_of_tokens acc))))) (cons term (parse rest_of_tokens)))))
(define (one-token-lookahead token tokens) (define (one-token-lookahead token tokens)
(match token (match token