The grammar is taken from the postgresql directory in the antlrv4 grammars repo.
All of the files in the /antlr
directory are taken directly from the repo. After copying the files from the repo, python3 transformGrammar.py
must be run from the root of the repo.
The string_stack.go
, postgresql_parser_base.go
, and postgresql_lexer_base.go
are also copied from the grammars repo.
The go files can then be generated by running the following commands from the ./antlr
directory:
antlr4 -Dlanguage=Go -o ../ ./PostgreSQLLexer.g4
antlr4 -Dlanguage=Go -o ../ ./PostgreSQLParser.g4