Update redex enumeration docs
This commit is contained in:
parent
1b1dc9cfb8
commit
09f05678a5
|
@ -1869,9 +1869,9 @@ Generates terms in a number of different ways:
|
||||||
(for/list ([i (in-range 20)])
|
(for/list ([i (in-range 20)])
|
||||||
(generate-term L any #:i-th i))]
|
(generate-term L any #:i-th i))]
|
||||||
|
|
||||||
In addition, all other pattern types are supported except for mismatch @racket[_!_]
|
In addition, all other pattern types are supported
|
||||||
patterns, mismatch repeat @racket[..._!_] patterns and @racket[side-condition]
|
except for mismatch repeat @racket[..._!_] patterns
|
||||||
patterns.
|
and @racket[side-condition] patterns.
|
||||||
|
|
||||||
The enumerators do not repeat terms unless the given pattern is ambiguous.
|
The enumerators do not repeat terms unless the given pattern is ambiguous.
|
||||||
Roughly speaking, the enumerator generates all possible ways that a pattern
|
Roughly speaking, the enumerator generates all possible ways that a pattern
|
||||||
|
@ -1899,6 +1899,16 @@ Generates terms in a number of different ways:
|
||||||
(for/list ([i (in-range 10)])
|
(for/list ([i (in-range 10)])
|
||||||
(generate-term L overlap #:i-th i))]
|
(generate-term L overlap #:i-th i))]
|
||||||
|
|
||||||
|
For similar reasons, enumerations for mismatch
|
||||||
|
patterns @racket[_!_] are unsound in the presence of
|
||||||
|
ambiguity, but work as expected for unambiguous
|
||||||
|
grammars.
|
||||||
|
|
||||||
|
@examples[#:eval
|
||||||
|
redex-eval
|
||||||
|
(define-language Bad
|
||||||
|
(ambig ::= (x ... x ...)))
|
||||||
|
(generate-term Bad (ambig_!_1 ambig_!_1 #:i-th 4))]
|
||||||
|
|
||||||
}
|
}
|
||||||
@item{@racket[from-judgment-form]: Randomly picks a term that satisfies
|
@item{@racket[from-judgment-form]: Randomly picks a term that satisfies
|
||||||
|
|
|
@ -105,13 +105,13 @@
|
||||||
(x number)
|
(x number)
|
||||||
|
|
||||||
;; Example of poorly behaved mismatch
|
;; Example of poorly behaved mismatch
|
||||||
(ambig (x ... x ...)))
|
(ambig (y ... y ...)))
|
||||||
|
|
||||||
(try-it 100 M m)
|
(try-it 100 M m)
|
||||||
(try-it 100 M n)
|
(try-it 100 M n)
|
||||||
(try-it 100 M p)
|
(try-it 100 M p)
|
||||||
;; Ambiguity kills us here
|
;; Ambiguity kills us here
|
||||||
;; (try-it 5 M (ambig_!_1 ambig_!_1))
|
;; (try-it 2 M (ambig_!_1 ambig_!_1))
|
||||||
|
|
||||||
;; test variable filtering
|
;; test variable filtering
|
||||||
(define-language Vars
|
(define-language Vars
|
||||||
|
|
Loading…
Reference in New Issue
Block a user