half-assed parser for nrp3c` added by mario-goulart on Sat Dec 10 09:26:28 2016
(define (numeric? char) (let ((i (char->integer char))) (and (< i 58) (> i 47)))) (define (parse-token token) (let ((chars (string->list (->string token)))) (let loop ((chars chars) (alphabetic '()) (numeric '())) (if (null? chars) (values (reverse alphabetic) (reverse numeric)) (let* ((char (car chars)) (num? (numeric? char))) (loop (cdr chars) (if num? alphabetic (cons char alphabetic)) (if num? (cons char numeric) numeric))))))) (with-input-from-file "file" (lambda () (let loop () (let ((token (read))) (unless (eof-object? token) (let-values (((alphabetic numeric) (parse-token token))) (printf "~a -> ~a\n" (list->string alphabetic) (list->string numeric))) (loop))))))