I am trying to gather information with regards to the grammar of PostgreSQL (and, in the future, other database systems) to be used in a website (frontend Angular, backend Java). It seems that the grammar rules are contained in the file gram.y
(https://github.com/postgres/postgres/blob/master/src/backend/parser/gram.y).
My question is the following: can I parse this grammar in both Java and Javascript, and how would I go about this? Having a single grammar file which can be read by Jison (http://zaa.ch/jison/docs/) or JavaCC (https://javacc.org/) would be ideal, as I would have a single truth. Basing myself on the source code of postgres itself would be as well a bonus, as I would have access to the various versions of the database.