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
517 B
Racket
21 lines
517 B
Racket
#lang br/quicklang
|
|
(require "parser.rkt")
|
|
|
|
(define (read-syntax path port)
|
|
(define parse-tree (parse path (tokenize port)))
|
|
(define module-datum `(module bf-mod bf-demo/expander
|
|
,parse-tree))
|
|
(datum->syntax #f module-datum))
|
|
(provide read-syntax)
|
|
|
|
(require parser-tools/lex)
|
|
(define (tokenize port)
|
|
(define (next-token)
|
|
(define our-lexer
|
|
(lexer
|
|
[(eof) eof]
|
|
[(char-set "><-.,+[]") lexeme]
|
|
[any-char (next-token)]))
|
|
(our-lexer port))
|
|
next-token)
|