Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytebase/plsql-parser
The parser for Oracle 11g/12c PL/SQL. It is based on the [ANTLR4](https://github.com/antlr/antlr4) and use the grammar from [antlr4-grammars-plsql](https://github.com/antlr/grammars-v4/tree/master/sql/plsql).
https://github.com/bytebase/plsql-parser
antlr antlr-parser antlr4 database oracle parser plsql sql sql-parser
Last synced: about 1 month ago
JSON representation
The parser for Oracle 11g/12c PL/SQL. It is based on the [ANTLR4](https://github.com/antlr/antlr4) and use the grammar from [antlr4-grammars-plsql](https://github.com/antlr/grammars-v4/tree/master/sql/plsql).
- Host: GitHub
- URL: https://github.com/bytebase/plsql-parser
- Owner: bytebase
- License: apache-2.0
- Created: 2023-05-08T04:19:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-17T10:02:36.000Z (about 2 months ago)
- Last Synced: 2024-12-25T06:02:46.477Z (about 1 month ago)
- Topics: antlr, antlr-parser, antlr4, database, oracle, parser, plsql, sql, sql-parser
- Language: ANTLR
- Homepage: https://www.bytebase.com
- Size: 24.7 MB
- Stars: 10
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The plsql-parser is a parser for Oracle 11g/12c PL/SQL. It is based on the [ANTLR4](https://github.com/antlr/antlr4) and use the grammar from [antlr4-grammars-plsql](https://github.com/antlr/grammars-v4/tree/master/sql/plsql).
## Build
Before build, you need to install the ANTLR4.
requirements:
- https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
- https://github.com/antlr/antlr4/blob/master/doc/go-target.md```bash
./build.sh
```## Update grammar
### Manually change the grammar file in this project
1. Update the `PlSqlLexer.g4` and `PlSqlParser.g4` in root directory.
2. run `./build.sh` to generate the parser code.### From antlr4-grammars-plsql
1. Clone the `PlSqlLexer.g4` and `PlSqlParser.g4` grammar files from https://github.com/antlr/grammars-v4/tree/master/sql/plsql into `parser` folder.
2. Clone the https://github.com/antlr/grammars-v4/blob/master/sql/plsql/Go/transformGrammar.py into root directory.
3. Run the `transformGrammar.py` to generate the `PlSqlLexer.g4` and `PlSqlParser.g4` in `parser` directory.
4. Copy the `PlSqlLexer.g4` and `PlSqlParser.g4` to root directory.
5. run `./build.sh` to generate the parser code.## Test the parser
Run `TestPLSQLParser` in `parser_test.go` to test the parser.
```bash
go test -v
```## References
- Oracle SQL Language Reference: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Introduction-to-Oracle-SQL.html
- ANTLR4 Getting Started https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
- ANTLR4 Go Garget https://github.com/antlr/antlr4/blob/master/doc/go-target.md