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
|
||||
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
|
||||
distribution. Before this, Redex was in PLaneT).
|
||||
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
(->d ([rel reduction-relation?])
|
||||
([file (or/c false/c path-string?)]
|
||||
#:style [style reduction-rule-style/c])
|
||||
[result (lambda (x)
|
||||
(if (path-string? file)
|
||||
(void? x)
|
||||
(pict? x)))])]
|
||||
[result (if (path-string? file)
|
||||
void?
|
||||
pict?)])]
|
||||
[reduction-relation->pict (->* (reduction-relation?)
|
||||
(#:style reduction-rule-style/c)
|
||||
pict?)]
|
||||
|
@ -37,10 +36,9 @@
|
|||
(->d ([lang compiled-lang?])
|
||||
([file (or/c false/c path-string?)]
|
||||
#:nts [nts (or/c false/c (listof (or/c string? symbol?)))])
|
||||
[result (lambda (x)
|
||||
(if (path-string? file)
|
||||
(void? x)
|
||||
(pict? x)))])])
|
||||
[result (if (path-string? file)
|
||||
void?
|
||||
pict?)])])
|
||||
|
||||
; syntax
|
||||
(provide metafunction->pict
|
||||
|
|
|
@ -1,50 +1,53 @@
|
|||
(module bitmap-test mzscheme
|
||||
(require "bitmap-test-util.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")
|
||||
#lang scheme
|
||||
(require "bitmap-test-util.ss"
|
||||
"../main.ss")
|
||||
|
||||
(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))
|
||||
;; 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")
|
||||
|
||||
(test (render-language lang #:nts '(e v)) "language-nox.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
|
||||
(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
|
||||
adjust @scheme[dc-for-text-size].
|
||||
|
||||
This function is
|
||||
primarily designed to be used with Slideshow or with
|
||||
other tools that combine picts together.
|
||||
This function is primarily designed to be used with
|
||||
Slideshow or with other tools that combine picts together.
|
||||
}
|
||||
|
||||
@defproc[(render-reduction-relation [rel reduction-relation?]
|
||||
[file (or/c false/c path-string?) #f]
|
||||
[#:style style reduction-rule-style/c (rule-pict-style)])
|
||||
[file (or/c false/c path-string?) #f]
|
||||
[#:style style reduction-rule-style/c (rule-pict-style)])
|
||||
(if file void? pict?)]{
|
||||
|
||||
Renders a reduction relation. If @scheme[file] is @scheme[#f],
|
||||
|
|
Loading…
Reference in New Issue
Block a user