Skip to content

Commit

Permalink
DONE. v1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjkellyjoo committed Dec 31, 2021
1 parent 84ebda1 commit c3cdcb4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ The currently maintained [Solidity parser by the Solidity team](https://github.c
I needed a universal parser which would be compatible with all compiler versions (especially v0.6.0 and lower), so this project is all about building a **complete Solidity parser able to parse all compiler versions of Solidity**.

This work includes:
1. _[Solidity Language grammar in ANTLR4](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/Solidity.g4) .g4 format._
1. _[`Solidity Language grammar in ANTLR4`](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/Solidity.g4) .g4 format._

The .g4 grammar is an extension of https://github.com/solidity-parser/antlr, where I have revised the grammar to accept code for all Solidity compiler versions up to v0.8.0.

2. _[visitor](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/MySolidityVisitor.py) and [listener](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/MySolidityListener.py) implementation in Python3._
2. _[`visitor`](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/MySolidityVisitor.py) and [`listener`](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/MySolidityListener.py) implementation in Python3._

I went through a lot of twists and turns writing these two because there weren't a lot of examples to refer to. I am opening my code hoping it would help people write their own visitor or listener implementations for their grammar written in ANTLR4.

Expand Down Expand Up @@ -138,11 +138,14 @@ If you wish to _edit the .g4 and try out your own grammar_, set up ANTLR4 (I hav
<!-- USAGE EXAMPLES -->

## Usage
### How to try out the visitor or the listener
I have written a sample code using the visitor and the listener in [`run_parser.py`](https://github.com/yjkellyjoo/Solidity-complete-parser/blob/main/run_parser.py).
Detailed explanation is provided through comments in the code.

Try them out and play with them by adding code lines in the `main` function!


TODO

### (Optional) To regenerate lexer and parser
If you have edited the .g4 file, you will have to regenerate its lexer and parser using the below command.
```shell
$ antlr4 -o /antlr4-generated/ -Dlanguage=Python3 -visitor Solidity.g4
```
Expand All @@ -153,7 +156,6 @@ For more information on the usage options, refer to [ANTLR Tool Command Line Opt




<!-- CONTRIBUTING -->

## Contributing
Expand Down

0 comments on commit c3cdcb4

Please sign in to comment.