Skip to content

Commit 0a0122a

Browse files
committed
document a grammar for binding-pattern
related to racket#101 closes racket#88
1 parent 51ae121 commit 0a0122a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

redex-doc/redex/scribblings/ref/languages.scrbl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
(non-terminal-name @#,ttpattern ...+)
2626
((non-terminal-name ...+) @#,ttpattern ...+)]
2727
[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))]
3134
[beta nothing
3235
symbol
3336
(shadow beta-seqence ...)]
@@ -76,7 +79,11 @@ binding forms makes safely manipulating terms containing binding simpler and eas
7679
need to write operations that (explicitly) respect the binding structure of the language.
7780

7881
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
8087
declare any binding specifications, despite the clear intention of @racket[λ] as
8188
a binding form. To understand the consequences of not specifying any binding forms, consider
8289
the behavior of substitution on terms of @racket[_lc-lang].
@@ -362,12 +369,12 @@ which then is exported by the entire sequence.
362369
(+ x y z))
363370
x
364371
1)
365-
#:lang λL.4)
372+
#:lang lc-bind+let*)
366373
(term (substitute (let* ([x y] [y x])
367374
(+ x y z))
368375
y
369376
2)
370-
#:lang λL.4)]
377+
#:lang lc-bind+let*)]
371378
}
372379

373380
@defidform[::=]{

0 commit comments

Comments
 (0)