I want to parse my contract written in solidity to AST, do some analysis on AST and editing,then generate that edited version back to source code so it is possible to execute it.
I know I can do colc --ast-json which gives AST for the contract.
I know there are solidity-parser, solparse for going from code to AST. However, solc and these two tools produce different ASTs.
I tried using soltar(for going from AST back to code) which is meant to be used with solidity-parser or solparse. However it only works with version 0.1.0 of the parsers which means I am missing out a lot of Solidity language. And soltar seems to be missing out contract names so I am sure along the way I would find more bugs like this.
Are there any other helpful tools that can help me do this? Do you think it is feasible to implement something like this with very good accuracy so the generated code from AST is executable and correct?
It would also be good if I could use solc on AST instead of just source code but I don't think it is possible.