Commit f0043966 authored by James R. Wilcox's avatar James R. Wilcox
Browse files

start grammar fuzzer

parent 93fbbcf4
......@@ -188,3 +188,32 @@ Similar to the previous fuzzer except that it tracks an `int` that counts the
number of open-but-not-yet closed parentheses. In order to make this tracking
easier, this fuzzer does not generate comments (since parentheses inside
comments wouldn't count).
## Grammar fuzzer
Our previous fuzzer structurally eliminated balanced parentheses errors. Yay!
But the majority of the resulting programs had abstract syntax errors. Let's now
structurally eliminate those.
The strategy will be to think about generating *trees* (in particular, ASTs)
instead of sequences of tokens. At each step, the fuzzer will randomly decide
what kind of binding to produce, and then for that binding, will generate the
right number of arguments. Similarly, when generating expressions, it will first
select what kind of expression to generate, and then generate the right number
for arguments.
Let's take a look at the numbers
```
Paren:0
Abstract:0
Unbound Variables:307831
Unbound Functions:195843
Other Runtime:443764
StackOverflows:0
Programs:52562
Total:1000000
```
### The generating procedure
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment