I am trying to build code generation and transformation tool and hence I need software for Abstract Syntax Tree manipulation for at least three languages (Coq, Haskell, Java). So far I have managed to find custom software for 2 of the languages (Haskell, Java) and I wonder - why there is no universal program that can take BNF grammar and generate manipulation tool from it? There are universal YACC parser generator and why there is no universal AST manipulation tool generator? I am considering building one myself (I have no other option), but it could be smart to consider the reason why something similar has not been done so far? Maybe I should not do it as well?
I can image the following overall design of such tool: 1) I can use YACC parser generator to arrive at some graph structure; 2) I can import this graph structure in some general graph manipulation library (I guess, there should exist some) and do manipulation there. So, one should combine existing software only here, isn't so?
I have two use cases for such tool:
- Immediate used case: I have to simulate term rewriting in Coq (I have relevant SO question about this, there is no tool currently available).
But I guess that there can be many for uses cases.