You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
512 B
Racket
21 lines
512 B
Racket
8 years ago
|
#lang br/quicklang
|
||
8 years ago
|
(require "parser.rkt")
|
||
8 years ago
|
|
||
|
(define (read-syntax path port)
|
||
|
(define parse-tree (parse path (tokenize port)))
|
||
8 years ago
|
(define module-datum `(module bf-mod bf/expander
|
||
8 years ago
|
,parse-tree))
|
||
|
(datum->syntax #f module-datum))
|
||
|
(provide read-syntax)
|
||
8 years ago
|
|
||
8 years ago
|
(require parser-tools/lex)
|
||
8 years ago
|
(define (tokenize port)
|
||
9 years ago
|
(define (next-token)
|
||
8 years ago
|
(define our-lexer
|
||
|
(lexer
|
||
8 years ago
|
[(eof) eof]
|
||
9 years ago
|
[(char-set "><-.,+[]") lexeme]
|
||
8 years ago
|
[any-char (next-token)]))
|
||
8 years ago
|
(our-lexer port))
|
||
9 years ago
|
next-token)
|