From 89c652afd66762a5efe6e2a59d50652a4f5acc92 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 6 Jun 2019 18:54:24 -0700 Subject: [PATCH] mirror demo --- beautiful-racket-demo/mirror-demo/main.rkt | 18 ++++++++++++++++++ beautiful-racket-demo/mirror-demo/test.rkt | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 beautiful-racket-demo/mirror-demo/main.rkt create mode 100644 beautiful-racket-demo/mirror-demo/test.rkt diff --git a/beautiful-racket-demo/mirror-demo/main.rkt b/beautiful-racket-demo/mirror-demo/main.rkt new file mode 100644 index 0000000..1db5b46 --- /dev/null +++ b/beautiful-racket-demo/mirror-demo/main.rkt @@ -0,0 +1,18 @@ +#lang br/quicklang + +(module reader br + (provide (rename-out [rs read-syntax])) + (define (rs src ip) + (define toks (for/list ([tok (in-port (λ (p) (read-syntax src ip)) ip)]) + tok)) + (strip-context + (with-syntax ([(PT ...) toks]) + #'(module _ mirror-demo + PT ...))))) + +(provide (except-out (all-from-out br/quicklang) #%module-begin) + (rename-out [mb #%module-begin])) + +(define-macro (mb PT ...) + #'(#%module-begin + PT ...)) \ No newline at end of file diff --git a/beautiful-racket-demo/mirror-demo/test.rkt b/beautiful-racket-demo/mirror-demo/test.rkt new file mode 100644 index 0000000..d12b194 --- /dev/null +++ b/beautiful-racket-demo/mirror-demo/test.rkt @@ -0,0 +1,4 @@ +#lang mirror-demo + +"hello world" +(+ 1 (* 2 (- 3))) \ No newline at end of file