diff options
Diffstat (limited to '2021/day4/reader.rkt')
-rw-r--r-- | 2021/day4/reader.rkt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/2021/day4/reader.rkt b/2021/day4/reader.rkt new file mode 100644 index 0000000..b777f92 --- /dev/null +++ b/2021/day4/reader.rkt @@ -0,0 +1,21 @@ +#lang racket + +(require "parser.rkt") +(require brag/support) + +(define (make-tokenizer port) + (define (next-token) + (define bf-lexer + (lexer + [(char-set "\n1234567890, ") lexeme] + [any-char (next-token)])) + (bf-lexer port)) + next-token) + +(define (read-syntax path port) + (define parse-tree (parse path (make-tokenizer port))) + (define module-datum `(module day4 racket + ,parse-tree)) + (datum->syntax #f module-datum)) + +(provide read-syntax) |