diff --git a/br/ex/simples/stack/stacker/info.rkt b/br/ex/simples/stack/stacker/info.rkt deleted file mode 100644 index a85009f..0000000 --- a/br/ex/simples/stack/stacker/info.rkt +++ /dev/null @@ -1,2 +0,0 @@ -#lang info -(define collection "stacker") \ No newline at end of file diff --git a/br/ex/simples/stack/stacker/stacker-test.rkt b/br/ex/simples/stack/stacker/stacker-test.rkt deleted file mode 100644 index 9a4b760..0000000 --- a/br/ex/simples/stack/stacker/stacker-test.rkt +++ /dev/null @@ -1,6 +0,0 @@ -#lang reader "stacker-lang.rkt" -push 4 -push 8 -+ -push 3 -* \ No newline at end of file diff --git a/br/ex/simples/stack/stacker/stacker-lang.rkt b/br/ex/simples/stacker/stacker-lang.rkt similarity index 62% rename from br/ex/simples/stack/stacker/stacker-lang.rkt rename to br/ex/simples/stacker/stacker-lang.rkt index 47eaac0..7f382b8 100644 --- a/br/ex/simples/stack/stacker/stacker-lang.rkt +++ b/br/ex/simples/stacker/stacker-lang.rkt @@ -1,12 +1,14 @@ #lang br -(define (read-syntax src-path src-port) - (define src-strs (port->lines src-port)) - (define (make-datum str) (format-datum '(dispatch ~a) str)) - (define src-exprs (map make-datum src-strs)) - (inject-syntax ([#'(list src-expr ...) src-exprs]) - #'(module stacker-mod "stacker-lang.rkt" - src-expr ...))) -(provide read-syntax) + +(module reader br + (define (read-syntax src-path src-port) + (define src-strs (port->lines src-port)) + (define (make-datum str) (format-datum '(dispatch ~a) str)) + (define src-exprs (map make-datum src-strs)) + (inject-syntax ([#'(list src-expr ...) src-exprs]) + #'(module stacker-mod "stacker-lang.rkt" + src-expr ...))) + (provide read-syntax)) (define #'(stacker-module-begin reader-line ...) #'(#%module-begin diff --git a/br/ex/simples/stacker/stacker-test.rkt b/br/ex/simples/stacker/stacker-test.rkt new file mode 100644 index 0000000..30c533c --- /dev/null +++ b/br/ex/simples/stacker/stacker-test.rkt @@ -0,0 +1,6 @@ +#lang reader (submod "stacker-lang.rkt" reader) +push 4 +push 8 ++ +push 3 +* \ No newline at end of file diff --git a/br/scribble-xexpr.rkt b/br/scribble-xexpr.rkt deleted file mode 100644 index 0765ebd..0000000 --- a/br/scribble-xexpr.rkt +++ /dev/null @@ -1,40 +0,0 @@ -#lang at-exp br -(require scribble/manual scribble/core txexpr) -(provide scribble->xexpr) - -(define (style->attrs s style-accessor) - (let* ([style-datum (style-accessor s)]) - (if (style? style-datum) ; either style struct, or simple symbol name - `((style ,(~a (style-name style-datum))) - (properties ,(string-join (map ~a (style-properties style-datum)) " "))) - `((style ,(~a style-datum)))))) - - -;; Unfortunately there seems to be no generic way of fetching the style & elements from a Scribble structure -;; the specific struct accessors must be used. -(define #'structure->txexpr - (λ(stx) - (syntax-match stx - [#'(_ structure-name elem-name id) - (syntax-let ([#'structure-name-elem-name (format-id stx "~a-~a" #'structure-name #'elem-name)] - [#'structure-name-style (format-id stx "~a-style" #'structure-name)]) - #'(let* ([elem-raw (structure-name-elem-name id)] - [elems (map scribble->xexpr (if (list? elem-raw) - (flatten elem-raw) - (list elem-raw)))]) -(list* 'structure-name (style->attrs id structure-name-style) elems)))]))) - -(define (scribble->xexpr s) - (cond - [(nested-flow? s) (structure->txexpr nested-flow blocks s)] - [(paragraph? s) (structure->txexpr paragraph content s)] - [(element? s) (structure->txexpr element content s)] - [else s])) - -(module+ test - (require rackunit) - (define-simple-check (check-sx? s) - (check-true (txexpr? (scribble->xexpr s)))) - (check-sx? @racketblock[(list +)]) - (check-sx? @racket[(list +)]) - (check-sx? @code{(list +)})) diff --git a/br/test.rkt b/br/test.rkt new file mode 100644 index 0000000..2e4ecd2 --- /dev/null +++ b/br/test.rkt @@ -0,0 +1,5 @@ +#lang racket/base +(provide message) +(define message "You installed beautiful-racket correctly.") +(module+ main + (displayln message)) \ No newline at end of file