Fix metafunctions so that the LHSes are rewritten also.
svn: r13457
This commit is contained in:
parent
2b54135394
commit
facfa48e80
|
@ -111,5 +111,33 @@
|
|||
|
||||
(test (render-metafunction multi-arg) "metafunction-multi-arg.png")
|
||||
|
||||
;; makes sure that the LHS and RHS of metafunctions are appropriately
|
||||
;; rewritten
|
||||
|
||||
(define-metafunction lang
|
||||
subst : e x e -> e
|
||||
[(subst x x e) e]
|
||||
[(subst number x e) number]
|
||||
[(subst x_1 x_2 e) x_1]
|
||||
[(subst (e_1 e_2) x e)
|
||||
((subst e_1 x e) (subst e_2 x e))]
|
||||
[(subst (λ (x) e_b) x e)
|
||||
(λ (x) e)]
|
||||
[(subst (λ (x_f) e_f) x_a e_a)
|
||||
(λ (x_f) (subst e_f x_a e_a))])
|
||||
|
||||
(define (subst-rw lws)
|
||||
(list ""
|
||||
(list-ref lws 2)
|
||||
"{"
|
||||
(list-ref lws 3)
|
||||
":="
|
||||
(list-ref lws 4)
|
||||
"}"))
|
||||
|
||||
(test (with-compound-rewriter 'subst subst-rw
|
||||
(render-metafunction subst))
|
||||
"metafunction-subst.png")
|
||||
|
||||
(printf "bitmap-test.ss: ")
|
||||
(done)
|
||||
|
|
BIN
collects/redex/private/bmps/metafunction-subst.png
Normal file
BIN
collects/redex/private/bmps/metafunction-subst.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -748,7 +748,7 @@
|
|||
;; the first loc wrapper is just there to make the
|
||||
;; shape of this line be one that the apply-rewrites
|
||||
;; function (in core-layout.ss) recognizes as a metafunction
|
||||
(make-lw ""
|
||||
(make-lw "("
|
||||
(lw-line an-lw)
|
||||
0
|
||||
(lw-column an-lw)
|
||||
|
|
Loading…
Reference in New Issue
Block a user