Skip to content

Minimum Viable Grammar#1768

Merged
fubuloubu merged 24 commits into
vyperlang:masterfrom
jacqueswww:brute_grammar
Jan 2, 2020
Merged

Minimum Viable Grammar#1768
fubuloubu merged 24 commits into
vyperlang:masterfrom
jacqueswww:brute_grammar

Conversation

@jacqueswww

@jacqueswww jacqueswww commented Dec 15, 2019

Copy link
Copy Markdown
Contributor

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 Work on this PR or issue is not yet complete but reviewers are free to add their input for guidance. label Dec 15, 2019

@fubuloubu fubuloubu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is seriously cool

Comment thread tests/grammar/vyper.lark
Comment thread vyper/ast.py
Comment thread tests/grammar/test_grammar.py
Comment thread tests/grammar/test_decorators_grammar.py
Comment thread tests/grammar/test_grammar.py Outdated
@fubuloubu

Copy link
Copy Markdown
Contributor

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

Comment thread tests/grammar/test_grammar.py
Comment thread tests/grammar/conftest.py
Comment thread tests/grammar/vyper.lark
@jacqueswww jacqueswww removed the work in progress Work on this PR or issue is not yet complete but reviewers are free to add their input for guidance. label Dec 18, 2019
@jacqueswww jacqueswww changed the title Minimum Viable Grammar (Bruteforce grammar) Minimum Viable Grammar Dec 18, 2019
Comment thread setup.py Outdated
Co-Authored-By: Bryant Eisenbach <3859395+fubuloubu@users.noreply.github.com>
@lgtm-com

lgtm-com Bot commented Dec 19, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

@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 December 19, 2019 13:11
@fubuloubu

fubuloubu commented Dec 19, 2019

Copy link
Copy Markdown
Contributor

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

Also, the tests still take 8 mins...

@charles-cooper

Copy link
Copy Markdown
Member

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

@fubuloubu

Copy link
Copy Markdown
Contributor

@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

jacqueswww commented Dec 20, 2019

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Contributor Author

@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
Copy Markdown
Contributor Author

@fubuloubu figured it out 😸

@charles-cooper charles-cooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. LGTM thanks!

Comment thread .github/workflows/test.yml
@fubuloubu fubuloubu merged commit cbd9ecb into vyperlang:master Jan 2, 2020
@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.

3 participants