|
25 | 25 | (non-terminal-name @#,ttpattern ...+)
|
26 | 26 | ((non-terminal-name ...+) @#,ttpattern ...+)]
|
27 | 27 | [maybe-binding-spec (code:line)
|
28 |
| - (code:line #:binding-forms binding-declaration ...)] |
29 |
| - [binding-declaration binding-pattern |
30 |
| - (code:line binding-pattern #:exports beta)] |
| 28 | + (code:line #:binding-forms binding-pattern ...)] |
| 29 | + [binding-pattern |
| 30 | + pattern |
| 31 | + (code:line binding-pattern #:exports beta) |
| 32 | + (code:line binding-pattern #:refers-to beta) |
| 33 | + (code:line binding-pattern #:...bind (id id beta))] |
31 | 34 | [beta nothing
|
32 | 35 | symbol
|
33 | 36 | (shadow beta-seqence ...)]
|
@@ -76,7 +79,11 @@ binding forms makes safely manipulating terms containing binding simpler and eas
|
76 | 79 | need to write operations that (explicitly) respect the binding structure of the language.
|
77 | 80 |
|
78 | 81 | When @racket[maybe-binding-spec] is provided, it declares binding specifications
|
79 |
| -for certain forms in the language. The language, @racket[_lc-lang], above does not |
| 82 | +for certain forms in the language. The @racket[binding-pattern] specification is an |
| 83 | +extension of Redex's @|pattern| language, allowing the keywords @racket[#:refers-to], |
| 84 | +@racket[#:exports], and @racket[#:...binds] to appear nested inside a binding pattern. |
| 85 | + |
| 86 | +The language, @racket[_lc-lang], above does not |
80 | 87 | declare any binding specifications, despite the clear intention of @racket[λ] as
|
81 | 88 | a binding form. To understand the consequences of not specifying any binding forms, consider
|
82 | 89 | the behavior of substitution on terms of @racket[_lc-lang].
|
@@ -362,12 +369,12 @@ which then is exported by the entire sequence.
|
362 | 369 | (+ x y z))
|
363 | 370 | x
|
364 | 371 | 1)
|
365 |
| - #:lang λL.4) |
| 372 | + #:lang lc-bind+let*) |
366 | 373 | (term (substitute (let* ([x y] [y x])
|
367 | 374 | (+ x y z))
|
368 | 375 | y
|
369 | 376 | 2)
|
370 |
| - #:lang λL.4)] |
| 377 | + #:lang lc-bind+let*)] |
371 | 378 | }
|
372 | 379 |
|
373 | 380 | @defidform[::=]{
|
|
0 commit comments