|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
#lang br/quicklang
|
|
|
|
|
(require brag/support "grammar.rkt")
|
|
|
|
|
(provide (all-from-out br/quicklang) (all-defined-out))
|
|
|
|
|
(provide taco-program taco-leaf
|
|
|
|
|
taco not-a-taco
|
|
|
|
|
show
|
|
|
|
|
#%module-begin)
|
|
|
|
|
|
|
|
|
|
(module+ reader
|
|
|
|
|
(provide read-syntax))
|
|
|
|
|
|
|
|
|
|
(define (tokenize ip)
|
|
|
|
|
(define (tokenize-1 ip)
|
|
|
|
|
(define lex
|
|
|
|
|
(lexer
|
|
|
|
|
["#$" lexeme]
|
|
|
|
@ -25,10 +28,13 @@
|
|
|
|
|
|
|
|
|
|
(define (not-a-taco) 0)
|
|
|
|
|
|
|
|
|
|
(define (show pt)
|
|
|
|
|
(display (apply string pt)))
|
|
|
|
|
|
|
|
|
|
(define (read-syntax src ip)
|
|
|
|
|
(define token-thunk (λ () (tokenize ip)))
|
|
|
|
|
(define parse-tree (parse token-thunk))
|
|
|
|
|
(define token-thunk (λ () (tokenize-1 ip)))
|
|
|
|
|
(define parse-tree (parse src token-thunk))
|
|
|
|
|
(strip-context
|
|
|
|
|
(with-syntax ([PT parse-tree])
|
|
|
|
|
#'(module winner taco-victory-demo
|
|
|
|
|
(display (apply string PT))))))
|
|
|
|
|
(show PT)))))
|