Re: [racket-users] grammar-based fuzzing

2019-06-06 Thread Jay McCarthy
`redex-check` is what you want. If it isn't exactly what you need,
then `data/enumerate` will help you build what you need very easily.

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.

On Thu, Jun 6, 2019 at 3:21 PM Ryan Kramer  wrote:
>
> Does Racket have any grammar-based fuzzing utilities? I'm probably going to 
> play around with this either way, but if there is an existing solution I'll 
> quit after I've had my fun. If, however, people think Racket could use 
> something like this I may attempt to make it into a usable package.
>
> I'm thinking specifically about generating inputs for Quickcheck, but such a 
> fuzzer might have other uses.
>
> For example, given this grammar:
>
> (struct tree (left right) #:transparent)
>
> (define-grammar tree-grammar
>   [Leaf (:choose-integer - )]
>   [Subtree #'(tree Node Node)]
>   [Node #:max-nesting 10
> (:weighted-choice
>  [1 Leaf]
>  [5 Subtree])])
>
> Then (tree-grammar 'Subtree) might generate #'(tree 1 (tree 2 3)) as one of 
> many possibilities.
>
> An important feature that I haven't seen yet is tracking/scoping identifiers. 
> There are times when we want to generate any arbitrary identifier, and other 
> times when we want to use an existing identifier that we know is in scope. 
> For example, if we were fuzzing `let` we might have
>
> (define-grammar let-grammar
>   [Root #'(let ([LetId LetVal]
> ...)
> LetBody)]
>   [LetId (:choose-identifier)]
>   ; TODO ...
>   )
>
> And somehow we want to say that LetBody can and should use the enclosing 
> LetIds, but I don't immediately see a great way to communicate that. It might 
> be possible to have something like (:choose-bound LetId) which would generate 
> a LetId that is known to be in scope.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/832ed76d-33f6-4f3f-b80f-da891613b6a3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJYbDakB4emkdCO_noMaB6v_-RQUU1AJS_KBAQYprpkH%2BOCZaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] grammar-based fuzzing

2019-06-06 Thread Ryan Kramer
Does Racket have any grammar-based fuzzing utilities? I'm probably going to 
play around with this either way, but if there is an existing solution I'll 
quit after I've had my fun. If, however, people think Racket could use 
something like this I may attempt to make it into a usable package.

I'm thinking specifically about generating inputs for Quickcheck, but such 
a fuzzer might have other uses.

For example, given this grammar:

(struct tree (left right) #:transparent)

(define-grammar tree-grammar
  [Leaf (:choose-integer - )]
  [Subtree #'(tree Node Node)]
  [Node #:max-nesting 10
(:weighted-choice
 [1 Leaf]
 [5 Subtree])])

Then (tree-grammar 'Subtree) might generate #'(tree 1 (tree 2 3)) as one of 
many possibilities.

An important feature that I haven't seen yet is tracking/scoping 
identifiers. There are times when we want to generate any arbitrary 
identifier, and other times when we want to use an existing identifier that 
we know is in scope. For example, if we were fuzzing `let` we might have

(define-grammar let-grammar
  [Root #'(let ([LetId LetVal]
...)
LetBody)]
  [LetId (:choose-identifier)]
  ; TODO ...
  )

And somehow we want to say that LetBody can and should use the enclosing 
LetIds, but I don't immediately see a great way to communicate that. It 
might be possible to have something like (:choose-bound LetId) which would 
generate a LetId that is known to be in scope.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/832ed76d-33f6-4f3f-b80f-da891613b6a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.