|
|
@ -1,12 +1,13 @@
|
|
|
|
#lang br
|
|
|
|
#lang br/quicklang
|
|
|
|
(require parser-tools/lex brag/support)
|
|
|
|
(require parser-tools/lex brag/support)
|
|
|
|
|
|
|
|
|
|
|
|
(define (tokenize input-port)
|
|
|
|
(define (tokenize input-port)
|
|
|
|
(define (next-token)
|
|
|
|
(define (next-token)
|
|
|
|
(define get-token
|
|
|
|
(define get-token
|
|
|
|
(lexer-src-pos
|
|
|
|
(lexer-src-pos
|
|
|
|
[(char-set "><-.,+[]") lexeme]
|
|
|
|
[(char-set "><-.,+[]") lexeme]
|
|
|
|
[(char-complement (char-set "><-.,+[]"))
|
|
|
|
[(char-complement (char-set "><-.,+[]"))
|
|
|
|
(token 'OTHER #:skip? #t)]
|
|
|
|
(token 'OTHER #:skip? #t)]
|
|
|
|
[(eof) eof]))
|
|
|
|
[(eof) eof]))
|
|
|
|
(get-token input-port))
|
|
|
|
(get-token input-port))
|
|
|
|
next-token)
|
|
|
|
next-token)
|
|
|
@ -14,8 +15,6 @@
|
|
|
|
(require "bf-parser.rkt")
|
|
|
|
(require "bf-parser.rkt")
|
|
|
|
(define (read-syntax source-path input-port)
|
|
|
|
(define (read-syntax source-path input-port)
|
|
|
|
(define parse-tree (parse source-path (tokenize input-port)))
|
|
|
|
(define parse-tree (parse source-path (tokenize input-port)))
|
|
|
|
(strip-context
|
|
|
|
(datum->syntax #f `(module bf-mod br/demo/bf/bf-expander
|
|
|
|
(inject-syntax ([#'PARSE-TREE parse-tree])
|
|
|
|
,parse-tree)))
|
|
|
|
#'(module bf-mod br/demo/bf/bf-expander
|
|
|
|
|
|
|
|
PARSE-TREE))))
|
|
|
|
|
|
|
|
(provide read-syntax)
|
|
|
|
(provide read-syntax)
|
|
|
|