10 releases (stable)
new 1.2.9 | Nov 27, 2024 |
---|---|
1.2.7 | Jun 12, 2024 |
1.2.6 | May 26, 2024 |
1.2.4 | Apr 30, 2024 |
0.0.2 | Jun 16, 2021 |
#42 in #solidity
2.5MB
70K
SLoC
🌴 tree-sitter-solidity
💡 this grammar is still in development, the structure of the generated AST is not stable
This repository contains a grammar for tree-sitter.
The goal of this project is to provide an parser efficient low-dependency parser for solidity which targets most solidity versions in use and is designed for enabling metaprogramming.
Navigating this repository
The primary file in this repository is grammar.js
which describes the tree-sitter grammar.
# Primary file:
grammar.js
# Tests:
/test/**/*
# Auto generated:
/src/**/*
index.js
binding.gyp
References
-> Ethereum solidity grammar:
- https://github.com/ethereum/solidity/blob/develop/docs/grammar/SolidityParser.g4
- https://github.com/ethereum/solidity/blob/develop/docs/grammar/SolidityLexer.g4
- https://docs.soliditylang.org/en/latest/grammar.html?#
-> Tree-sitter javascript grammar: https://github.com/tree-sitter/tree-sitter-javascript/blob/master/grammar.js
-> Solidity antlr grammar: https://github.com/ConsenSys/solidity-parser-antlr
Major inspriration & some structures have been taken from tree-sitter-javascript, a big thanks to the contributors to this repo!
Dependencies
~2.8–4MB
~76K SLoC