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

Minimum Viable Grammar #1768

Merged
merged 24 commits into from Jan 2, 2020
Merged

Minimum Viable Grammar #1768

merged 24 commits into from Jan 2, 2020

Conversation

jacqueswww
Copy link
Contributor

@jacqueswww jacqueswww commented Dec 15, 2019

What I did

  • Adds lark grammar for Vyper.
  • Hooks grammar to be parsed for all get_contract_* function in testse.
  • Adds wildcard hypothesis test.

How I did it

How to verify it

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@jacqueswww jacqueswww added the work in progress label Dec 15, 2019
Copy link
Member

@fubuloubu fubuloubu left a comment

This is seriously cool

tests/grammar/vyper.lark Show resolved Hide resolved
vyper/ast.py Show resolved Hide resolved
tests/grammar/test_grammar.py Show resolved Hide resolved
tests/grammar/test_decorators_grammar.py Show resolved Hide resolved
tests/grammar/test_grammar.py Outdated Show resolved Hide resolved
@fubuloubu
Copy link
Member

@fubuloubu fubuloubu commented Dec 15, 2019

Unsure what the py36-core failure is. Does lark work with py36?

@jacqueswww jacqueswww removed the work in progress label Dec 18, 2019
@jacqueswww jacqueswww changed the title Minimum Viable Grammar (Bruteforce grammar) Minimum Viable Grammar Dec 18, 2019
setup.py Outdated Show resolved Hide resolved
Co-Authored-By: Bryant Eisenbach <3859395+fubuloubu@users.noreply.github.com>
@lgtm-com
Copy link

@lgtm-com lgtm-com bot commented Dec 19, 2019

This pull request introduces 1 alert when merging 8b5984d into e0bb58d - view on LGTM.com

new alerts:

  • 1 for Implicit string concatenation in a list

@jacqueswww
Copy link
Contributor Author

@jacqueswww jacqueswww commented Dec 19, 2019

@fubuloubu I have setup a separate hypthesis test case.

@jacqueswww jacqueswww force-pushed the brute_grammar branch 3 times, most recently from 9fdc633 to 3e46f50 Compare Dec 19, 2019
@fubuloubu
Copy link
Member

@fubuloubu fubuloubu commented Dec 19, 2019

@jacqueswww can you call it "fuzzing" instead of "long_run_time"?

Also, the tests still take 8 mins...

@charles-cooper
Copy link
Collaborator

@charles-cooper charles-cooper commented Dec 19, 2019

Seems this mainly fuzzes the grammar? Could you please update the PR description

@fubuloubu
Copy link
Member

@fubuloubu fubuloubu commented Dec 19, 2019

@charles-cooper correct. @jacqueswww created a vyper grammar from the python one, using the lark tool, and is using that to create a hypothesis strategy that generates source code which should be parseable by the grammar. If anything doesn't compile, the grammar is off; if anything does compile but crashes, we have an edge case in our grammar we are not handling appropiately.

@jacqueswww
Copy link
Contributor Author

@jacqueswww jacqueswww commented Dec 20, 2019

@charles-cooper Yeah so it's a fully fledged grammar now.
It started off fuzzing; but then also went further and proved that it can parse almost all of our tests (the ones that use get_contract functions) - which to me makes it a great 'official grammar' :o)

@jacqueswww
Copy link
Contributor Author

@jacqueswww jacqueswww commented Dec 20, 2019

@fubuloubu Alright I don't know why the tests are slower; but if you check the log output - you can clearly see hypthesis doesn't run anymore - so that's something.

@jacqueswww
Copy link
Contributor Author

@jacqueswww jacqueswww commented Dec 20, 2019

@fubuloubu figured it out 😸

Copy link
Collaborator

@charles-cooper charles-cooper left a comment

This is awesome. LGTM thanks!

@fubuloubu fubuloubu merged commit cbd9ecb into vyperlang:master Jan 2, 2020
8 checks passed
@protolambda protolambda mentioned this pull request Jan 21, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants