#solidity #parser

tree-sitter-solidity-unofficial

Solidity grammar for the tree-sitter parsing library (cloning from JoranHonig/tree-sitter-solidity)

2 releases

0.0.2 Apr 14, 2023
0.0.1 Apr 13, 2023

#26 in #solidity

MIT license

2MB
62K SLoC

C 61K SLoC JavaScript 1K SLoC // 0.0% comments Scheme 190 SLoC // 0.1% comments Rust 32 SLoC // 0.4% comments

🌴 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.

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:

-> 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.6–4MB
~72K SLoC