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.

Jus12
  • 356
  • 2
  • 12

2 Answers2

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

Richard Horrocks
  • 37,835
  • 13
  • 87
  • 144
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.

q9f
  • 32,913
  • 47
  • 156
  • 395
uzeidler
  • 131
  • 4