antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.24k stars 3.72k forks source link

Why there's no grammar for PostgreSQL? #1501

Closed sulaukad closed 2 years ago

sulaukad commented 5 years ago

I'm looking for PostgreSQL grammar, but I can't find any solution. There are few 5 years old repos on git hub with a proprietary license which is not suitable for me.

KvanTTT commented 5 years ago

There are at least several implementations:

Also, maybe it makes sense to look at our PL/SQL or MySQL grammars. Maybe there are a lot of things in common.

Marti2203 commented 5 years ago

@KvanTTT @sulaukad I can try porting this weekend if the author of the recent one has not responded

KvanTTT commented 5 years ago

I would wait at least one month because of @tshprecher (author) wrote in abovementioned issue the following:

Let me scramble to get as much done of this by the end of Oct 1 (one month).

mitar commented 5 years ago

Related: https://github.com/lfittl/libpg_query

yuanzhonglin commented 4 years ago

hello,I'm also looking for PostgreSQL grammar files,have you found it? I would appreciate it if you could offer some help.

Marti2203 commented 4 years ago

Check the two repositories linked and see if they are good enough for you. If not, message the maintainers of them to see what is going on. I am still interested in working on them.

AXEPOH commented 4 years ago

Hello, you can use our solution (it includes Postgres 12): https://github.com/pgcodekeeper/pgcodekeeper/blob/master/ru.taximaxim.codekeeper.core/antlr-src/SQLParser.g4

BowenXiao1999 commented 3 years ago

https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4 ShardingSphere also has a antlr4 for PG.

dioptre commented 1 year ago

Looks like there's one here https://github.com/apache/shardingsphere/tree/24867f7bb33a94b6f7274c408372d421ab61a498/parser/sql/dialect/postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen