diff options
author | Aria <me@aria.rip> | 2023-01-02 21:58:56 +0000 |
---|---|---|
committer | Aria <me@aria.rip> | 2023-01-02 21:58:56 +0000 |
commit | 5eb58ad076f2cd435b11b140820da224b60b73d5 (patch) | |
tree | 2a67939595fbf993ff04f69b9cd3f0aa20827d96 /2021/day4/reader.rkt |
initial commit
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) |