How to rewrite Antlr4 Parse Tree manually? -


i working on simple xquery processor , using antlr4 parse grammar. use visitor pattern walk through parse tree. want rewrite query if query meet condition. processor can process query if query directly use keyword "join" , meet "join" grammar.

i want first rewrite parse tree if query can changed join query or nothing if not. there way manually manipulate parse tree? adding rule context or construct new parse tree?

for antlr4, idiomatic approach decorate tree nodes analysis products, rather mutating tree structure. is, 1 or more tree walks can uses identify , mark nodes merged join , final walk output results.

of course, parse-tree walked generate separate ast that, in turn, walked , further structurally modified. antlr4 not provide support building , walking of such ast.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -