From 37951c7198d83cbf86b8884cdf17a8a7bb4fd8f8 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 20 Jul 2016 22:38:23 -0700 Subject: [PATCH] update bf --- beautiful-racket/br/demo/bf/bf-expander.rkt | 13 ++++--------- beautiful-racket/br/demo/bf/bf-reader.rkt | 11 +++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/beautiful-racket/br/demo/bf/bf-expander.rkt b/beautiful-racket/br/demo/bf/bf-expander.rkt index b83a5c8..16ba161 100644 --- a/beautiful-racket/br/demo/bf/bf-expander.rkt +++ b/beautiful-racket/br/demo/bf/bf-expander.rkt @@ -1,9 +1,6 @@ -#lang br - -(define-macro (bf-module-begin SRC-EXPR ...) - #'(#%module-begin - SRC-EXPR ...)) -(provide (rename-out [bf-module-begin #%module-begin])) +#lang br/quicklang + +(provide #%module-begin) (define-macro (bf-program OP-OR-LOOP ...) #'(begin OP-OR-LOOP ...)) @@ -29,6 +26,4 @@ (define-macro (loop LOOP-ARG ...) #'(until (zero? (get-current-byte)) LOOP-ARG ...)) -(provide loop) - -(provide #%top-interaction) \ No newline at end of file +(provide loop) \ No newline at end of file diff --git a/beautiful-racket/br/demo/bf/bf-reader.rkt b/beautiful-racket/br/demo/bf/bf-reader.rkt index a38b7e1..e5b1da6 100644 --- a/beautiful-racket/br/demo/bf/bf-reader.rkt +++ b/beautiful-racket/br/demo/bf/bf-reader.rkt @@ -1,12 +1,13 @@ -#lang br +#lang br/quicklang (require parser-tools/lex brag/support) + (define (tokenize input-port) (define (next-token) (define get-token (lexer-src-pos [(char-set "><-.,+[]") lexeme] [(char-complement (char-set "><-.,+[]")) - (token 'OTHER #:skip? #t)] + (token 'OTHER #:skip? #t)] [(eof) eof])) (get-token input-port)) next-token) @@ -14,8 +15,6 @@ (require "bf-parser.rkt") (define (read-syntax source-path input-port) (define parse-tree (parse source-path (tokenize input-port))) - (strip-context - (inject-syntax ([#'PARSE-TREE parse-tree]) - #'(module bf-mod br/demo/bf/bf-expander - PARSE-TREE)))) + (datum->syntax #f `(module bf-mod br/demo/bf/bf-expander + ,parse-tree))) (provide read-syntax)