pull/21/head
Matthew Butterick 6 years ago
parent 0fededb98a
commit 6d4f0a7b69

@ -1,11 +1,14 @@
#lang br/quicklang #lang br/quicklang
(require brag/support "grammar.rkt") (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 (module+ reader
(provide read-syntax)) (provide read-syntax))
(define (tokenize ip) (define (tokenize-1 ip)
(define lex (define lex
(lexer (lexer
["#$" lexeme] ["#$" lexeme]
@ -25,10 +28,13 @@
(define (not-a-taco) 0) (define (not-a-taco) 0)
(define (show pt)
(display (apply string pt)))
(define (read-syntax src ip) (define (read-syntax src ip)
(define token-thunk (λ () (tokenize ip))) (define token-thunk (λ () (tokenize-1 ip)))
(define parse-tree (parse token-thunk)) (define parse-tree (parse src token-thunk))
(strip-context (strip-context
(with-syntax ([PT parse-tree]) (with-syntax ([PT parse-tree])
#'(module winner taco-victory-demo #'(module winner taco-victory-demo
(display (apply string PT)))))) (show PT)))))
Loading…
Cancel
Save