The plsql-parser is a parser for Oracle 11g/12c PL/SQL. It is based on the ANTLR4 and use the grammar from antlr4-grammars-plsql.
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
./build.sh
- Update the
PlSqlLexer.g4
andPlSqlParser.g4
in root directory. - run
./build.sh
to generate the parser code.
- Clone the
PlSqlLexer.g4
andPlSqlParser.g4
grammar files from https://github.com/antlr/grammars-v4/tree/master/sql/plsql intoparser
folder. - Clone the https://github.com/antlr/grammars-v4/blob/master/sql/plsql/Go/transformGrammar.py into root directory.
- Run the
transformGrammar.py
to generate thePlSqlLexer.g4
andPlSqlParser.g4
inparser
directory. - Copy the
PlSqlLexer.g4
andPlSqlParser.g4
to root directory. - run
./build.sh
to generate the parser code.
Run TestPLSQLParser
in parser_test.go
to test the parser.
go test -v
- 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