This is very much related to #8, but has a more limited scope.
The aim is to generate jq that is semantically equivalent to the original query, without necessarily being pretty.
The purpose is to be able to manipulate the query using the AST and then go back to the textual syntax, so that it can be efficiently evaluated by other implementations like jq or gojq.