I've been exploring the usage of ANTLR for converting AIP-160 filter criteria into a PostgreSQL query. So far I've been able to parse the filter string into a ParseTree
using a grammer definition, but I've found no way to take the ParseTree
and turn it into a PostgreSQL query.
I've found a number of parsers (PostgreSQL query to ParseTree/AST) but nothing to go the other way around. (I'm guessing this is called a deparser
?)
Does this not already exist? Do I need to implement this myself?
If I could be pointed in the right direction that would be great. Ideally there is a Java library, but if I need to port from another language so be it. If there is nothing I believe I'll need to start something which is probably going to take a bit of time.
(I've searched the internet -- StackOverflow included -- for about 4 hours and just can't find anything. Perhaps my Google fu is not working today)