11

I scoured the Mix and Solidity repos for something like a formal definition of the language's grammar, so that one may generate parsers using tools like GrammarKit, but couldn't find anything.

Any pointers?

1

5 Answers 5

10

There's a file called grammar.txt in the Solidity repo:

https://github.com/ethereum/solidity/blob/develop/docs/grammar.txt

That's probably what you're looking for?

4
8

I wrote an ANTLR4 grammar for Solidity that you may find useful:

https://github.com/solidityj/solidity-antlr4

It can generate parsers in any of the ANTLR supported targets and it has full support for the Solidity language as of today.

2

Here's yet another link pointing to the solidity documentation:

http://solidity.readthedocs.io/en/develop/miscellaneous.html#language-grammar

0

There is also a grammar based on javascript grammar.

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.