roddyyaga / ppx_rapper

Syntax extension for writing SQL in OCaml
Other
139 stars 18 forks source link

Removing Pg_query dependency ? #42

Closed F-Loyer closed 8 months ago

F-Loyer commented 9 months ago

I had some trouble compiling pg_query on Windows (some include files unavailable and more).

I think that it could be interesting to replace the Pg_query.parse by a pure Ocaml parser (menhir/ocamllex). I could grab a Postgress grammar easily (from the antlr repository), then it could be quite straightforward.

What do you think of this project?

F-Loyer commented 8 months ago

I propose to close the proposal... A PgSQL parser is roughly 5000 lines (https://github.com/antlr/grammars-v4/blob/master/sql/postgresql/PostgreSQLParser.g4) and can be error prone to convert to menhir.

A best way is to adapt pg_query to Windows. It has already be done for Ruby (stripping all socket handling not needed to parse a SQL statement). I have just to adapt this port to OCaml.