2

Where can I find a machine readable grammar for EVM? (and for Solidity)

Also, apart from Solidity, what other high-level languages currently exist that compile to EVM opcodes?

The reason I am asking is I'm looking for (or trying to create) some static analysis tools that look at EVM or Solidity and find exploits like TheDAO.

2 Answers 2

3

The question of grammar - specifically for Solidity - has come up before:

...as has the question of what languages are available for writing smart contracts:

In addition to the languages mentioned in the previous (rather old) answer, there is also an experimental language based on Python called Viper.

Finally, I believe static analysis is something that the Browser Solidity folks have been looking at (see here), which together with the EVM enhancements outlined in issue #3404 will supposedly make code more easily statically analysed.

Edit:

Solidity's grammar.txt file has moved since the linked answer was posted. It can now be found here: https://github.com/ethereum/solidity/blob/develop/docs/grammar.txt

3
  • I saw the linked question on BNF grammar. Unfortunately, the links are all dead, so that answer is no longer useful.
    – Jus12
    Commented Jan 5, 2017 at 14:40
  • 1
    Hmm, good point. Solidity's grammar.txt can be found here: github.com/ethereum/solidity/blob/develop/docs/grammar.txt Commented Jan 5, 2017 at 15:04
  • This looks very similar to ANTLR. What language is this in?
    – Jus12
    Commented Jan 10, 2017 at 5:47
3

There is also a xText project and the xText gramma description is quite similar to BNF:

Solidity.xtext

xText uses ANTLR in the background.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.