JoranHonig/tree-sitter-solidity

Solidity grammar for tree sitter

186

stars

365

commits

Python

primary language

Feb 11, 2026

updated

grammar
hacktoberfest
parser
smart-contracts
solidity
tree-sitter
Browse cluster: Tree-sitter language parsers β†’

README

🌴 tree-sitter-solidity

Node.js CI npm version

πŸ’‘ 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.

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:

-> 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!

Contributors

JoranHonig

338 commits

beeb

8 commits

elopez

4 commits

onbjerg

3 commits

JoranHonig/tree-sitter-solidity

Solidity grammar for tree sitter

186

stars

365

commits

Python

primary language

Feb 11, 2026

updated

grammar
hacktoberfest
parser
smart-contracts
solidity
tree-sitter
Browse cluster: Tree-sitter language parsers β†’

README

🌴 tree-sitter-solidity

Node.js CI npm version

πŸ’‘ 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.

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:

-> 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!

Contributors

JoranHonig

338 commits

beeb

8 commits

elopez

4 commits

onbjerg

3 commits

Languages

Python

45.1%

JavaScript

33.2%

Solidity

13.6%

Tree-sitter Query

8.2%