svn: r11269
This commit is contained in:
parent
448b47a953
commit
e0edc70215
|
@ -3,6 +3,9 @@ v4.2
|
||||||
- added white-bracket-sizing to control how the brackets
|
- added white-bracket-sizing to control how the brackets
|
||||||
are typeset when rendering a metafunction.
|
are typeset when rendering a metafunction.
|
||||||
|
|
||||||
|
- added render-* functions that make it easier to experiment
|
||||||
|
with typesetting at the REPL.
|
||||||
|
|
||||||
v4.1 (this is the first version that was included in the PLT
|
v4.1 (this is the first version that was included in the PLT
|
||||||
distribution. Before this, Redex was in PLaneT).
|
distribution. Before this, Redex was in PLaneT).
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,9 @@
|
||||||
(->d ([rel reduction-relation?])
|
(->d ([rel reduction-relation?])
|
||||||
([file (or/c false/c path-string?)]
|
([file (or/c false/c path-string?)]
|
||||||
#:style [style reduction-rule-style/c])
|
#:style [style reduction-rule-style/c])
|
||||||
[result (lambda (x)
|
[result (if (path-string? file)
|
||||||
(if (path-string? file)
|
void?
|
||||||
(void? x)
|
pict?)])]
|
||||||
(pict? x)))])]
|
|
||||||
[reduction-relation->pict (->* (reduction-relation?)
|
[reduction-relation->pict (->* (reduction-relation?)
|
||||||
(#:style reduction-rule-style/c)
|
(#:style reduction-rule-style/c)
|
||||||
pict?)]
|
pict?)]
|
||||||
|
@ -37,10 +36,9 @@
|
||||||
(->d ([lang compiled-lang?])
|
(->d ([lang compiled-lang?])
|
||||||
([file (or/c false/c path-string?)]
|
([file (or/c false/c path-string?)]
|
||||||
#:nts [nts (or/c false/c (listof (or/c string? symbol?)))])
|
#:nts [nts (or/c false/c (listof (or/c string? symbol?)))])
|
||||||
[result (lambda (x)
|
[result (if (path-string? file)
|
||||||
(if (path-string? file)
|
void?
|
||||||
(void? x)
|
pict?)])])
|
||||||
(pict? x)))])])
|
|
||||||
|
|
||||||
; syntax
|
; syntax
|
||||||
(provide metafunction->pict
|
(provide metafunction->pict
|
||||||
|
|
|
@ -1,50 +1,53 @@
|
||||||
(module bitmap-test mzscheme
|
#lang scheme
|
||||||
(require "bitmap-test-util.ss"
|
(require "bitmap-test-util.ss"
|
||||||
"../main.ss")
|
"../main.ss")
|
||||||
|
|
||||||
;; tests:
|
|
||||||
;; - language,
|
|
||||||
;; - multi-line non-terminals, single-line non-terminals
|
|
||||||
(define-language lang
|
|
||||||
(e (e e)
|
|
||||||
x
|
|
||||||
(λ (x) e)
|
|
||||||
number)
|
|
||||||
(v number (λ (x) e))
|
|
||||||
((x y) variable-not-otherwise-mentioned))
|
|
||||||
(test (render-language lang) "language.png")
|
|
||||||
|
|
||||||
(define-extended-language lang++ lang
|
|
||||||
(e .... number (+ e e))
|
|
||||||
(v .... number))
|
|
||||||
|
|
||||||
(test (render-language lang++) "extended-language.png")
|
|
||||||
|
|
||||||
(define red
|
|
||||||
(reduction-relation
|
|
||||||
lang
|
|
||||||
(--> ((λ (x) e) v) (S x v e))))
|
|
||||||
|
|
||||||
;; tests: reduction-relation
|
|
||||||
(test (render-reduction-relation red)
|
|
||||||
"reduction-relation.png")
|
|
||||||
|
|
||||||
(test (render-reduction-relation
|
;; tests:
|
||||||
(extend-reduction-relation red lang (--> 1 2)))
|
;; - language,
|
||||||
"extended-reduction-relation.png")
|
;; - multi-line non-terminals, single-line non-terminals
|
||||||
|
(define-language lang
|
||||||
(define-metafunction lang
|
(e (e e)
|
||||||
[(S x v e) e])
|
x
|
||||||
|
(λ (x) e)
|
||||||
(test (render-metafunction S)
|
number)
|
||||||
"metafunction.png")
|
(v number (λ (x) e))
|
||||||
|
((x y) variable-not-otherwise-mentioned))
|
||||||
;; in this test, teh `x' is italic and the 'z' is sf, since 'x' is in the grammar, and 'z' is not.
|
|
||||||
(test (render-lw
|
(test (render-language lang) "language.png")
|
||||||
lang
|
|
||||||
(to-lw ((λ (x) (x x))
|
(test (render-language lang #:nts '(e v)) "language-nox.png")
|
||||||
(λ (z) (z z)))))
|
|
||||||
"lw.png")
|
(define-extended-language lang++ lang
|
||||||
|
(e .... number (+ e e))
|
||||||
(printf "bitmap-test.ss: ")
|
(v .... number))
|
||||||
(done))
|
|
||||||
|
(test (render-language lang++) "extended-language.png")
|
||||||
|
|
||||||
|
(define red
|
||||||
|
(reduction-relation
|
||||||
|
lang
|
||||||
|
(--> ((λ (x) e) v) (S x v e))))
|
||||||
|
|
||||||
|
;; tests: reduction-relation
|
||||||
|
(test (render-reduction-relation red)
|
||||||
|
"reduction-relation.png")
|
||||||
|
|
||||||
|
(test (render-reduction-relation
|
||||||
|
(extend-reduction-relation red lang (--> 1 2)))
|
||||||
|
"extended-reduction-relation.png")
|
||||||
|
|
||||||
|
(define-metafunction lang
|
||||||
|
[(S x v e) e])
|
||||||
|
|
||||||
|
(test (render-metafunction S)
|
||||||
|
"metafunction.png")
|
||||||
|
|
||||||
|
;; in this test, teh `x' is italic and the 'z' is sf, since 'x' is in the grammar, and 'z' is not.
|
||||||
|
(test (render-lw
|
||||||
|
lang
|
||||||
|
(to-lw ((λ (x) (x x))
|
||||||
|
(λ (z) (z z)))))
|
||||||
|
"lw.png")
|
||||||
|
|
||||||
|
(printf "bitmap-test.ss: ")
|
||||||
|
(done)
|
||||||
|
|
BIN
collects/redex/private/bmps/language-nox.png
Normal file
BIN
collects/redex/private/bmps/language-nox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -1191,14 +1191,13 @@ are otherwise setting @scheme[dc-for-text-size]. }
|
||||||
Produce a pict like @scheme[render-language], but without
|
Produce a pict like @scheme[render-language], but without
|
||||||
adjust @scheme[dc-for-text-size].
|
adjust @scheme[dc-for-text-size].
|
||||||
|
|
||||||
This function is
|
This function is primarily designed to be used with
|
||||||
primarily designed to be used with Slideshow or with
|
Slideshow or with other tools that combine picts together.
|
||||||
other tools that combine picts together.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defproc[(render-reduction-relation [rel reduction-relation?]
|
@defproc[(render-reduction-relation [rel reduction-relation?]
|
||||||
[file (or/c false/c path-string?) #f]
|
[file (or/c false/c path-string?) #f]
|
||||||
[#:style style reduction-rule-style/c (rule-pict-style)])
|
[#:style style reduction-rule-style/c (rule-pict-style)])
|
||||||
(if file void? pict?)]{
|
(if file void? pict?)]{
|
||||||
|
|
||||||
Renders a reduction relation. If @scheme[file] is @scheme[#f],
|
Renders a reduction relation. If @scheme[file] is @scheme[#f],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user