Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser-guided fuzzer #1077

Closed
jsatdapr opened this issue Jul 20, 2021 · 5 comments
Closed

Parser-guided fuzzer #1077

jsatdapr opened this issue Jul 20, 2021 · 5 comments
Assignees

Comments

@jsatdapr
Copy link
Contributor

Issue To Be Solved

The grammar in docs/cadence.ebnf is not obviously correct, but not strictly necessary. We can have a parser-guided fuzzer, without a formal grammar, simply by refactoring the parser to specify which tokens it accepts, each time it asks the lexer for the next one.

Tasks

  1. Make Token.Type and Token.Value be functions, not bare data
  2. Annotate calls to Token.Type() and Token.Value() with lists of expected results
  3. At each call to Token.Type() or Token.Value(), the fuzzer selects from the list of expected results.
  4. Figure out how to structure code so that the behavior of Type() and Value() is unchanged when not running the fuzzer.
@jsatdapr
Copy link
Contributor Author

Note: since the "grammar" here is implicit and generated on-the-fly during parsing, it's impossible to "balance" it ahead of time, something that is possible with a formal grammar: #1062

@jsatdapr
Copy link
Contributor Author

Note: performance regression is a concern here, since we are hiding Token.Type and Token.Value behind a "getter" function call, where they were previously just plain data. I will run the benchmarks and post the results here for further discussion.

@jsatdapr
Copy link
Contributor Author

Placing Token behind an interface caused no noticeable loss in performance, even with grammar-checking enabled at runtime.

@jsatdapr
Copy link
Contributor Author

This is blocked on subtask #1094

@robert-e-davidson3
Copy link
Contributor

Deprecating this ticket in favor of epic #1309.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants