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

Couple "error on ambiguity" with a fuzzer to generate ambiguous inputs. #26

Open
eddyb opened this issue Aug 24, 2018 · 2 comments
Open

Comments

@eddyb
Copy link
Member

eddyb commented Aug 24, 2018

Because of how GLL control-flow maps all the way down to machine code, it should be possible for a program-trace-aware fuzzer to hit enough codepaths to cause an ambiguity through its crafted input.

(suggested by @nikomatsakis)


Alternatively, we could try to transform the grammar to reveal ambiguities more easily - e.g. turn A | B | C into (A & B) | (B & C) | (A & C) and aggressively optimize it.
That sort of grammar might not need the SPPF, making it more efficient, if it "succeeds if ambiguous" (not "iff" because that's harder/impossible to obtain in general).

@nikomatsakis
Copy link

nikomatsakis commented Aug 24, 2018

Just for completeness, the other, maybe easier, option is just to exhaustively enumerate all "sentences" in the grammar up to some maximum length. My hypothesis is that grammatical ambiguities don't usually take more than a few characters to show up -- at least for programming languages -- so if you enumerate everything up to some reasonable length, you can be fairly confident you've found them all.

@Centril
Copy link
Contributor

Centril commented Sep 13, 2018

For future reference: @nikomatsakis's idea seems similar to what what I had in mind in proptest-rs/proptest#61 save for the exhaustiveness (as PBT tools like proptest and Haskell's QuickCheck usually randomize tests).

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

No branches or pull requests

3 participants