I've done more or less the same thing as you're doing when writing pg-mem, which is an in-memory postgres database emulation.
So to answer your question: I've published a separate npm package for its parser pgsql-ast-parser, which is using nearley, one of the many solutions that you can use to write a parser with nodejs (I've also played with pegjs when contributing to node-sql-parser, but I felt that Nearley is more powerful)
I've done more or less the same thing as you're doing when writing pg-mem, which is an in-memory postgres database emulation.
So to answer your question: I've published a separate npm package for its parser pgsql-ast-parser, which is using nearley, one of the many solutions that you can use to write a parser with nodejs (I've also played with pegjs when contributing to node-sql-parser, but I felt that Nearley is more powerful)
Hey Oliver
Thanks for the tips on the parser
I've done a quick reading on the nearly and will try to implement it tomorrow in this project