Is there a way to convert code from one high-level representation to another? For example, in Javascript, a popular way of maintaining state is with a third-party library called Redux. VueJS on the other hand, has its own version of Redux, which is slightly similar but different. Is there a way to automagically convert between the two representations?
I suspect there might be a way using ASTs; however, at least in JS, ASTs seem to be good at low-level transforms, ex: const x = 2*4
to const x = 8
. However (and again, at least for JS), making higher-level transformations like the one I described above seem painful.
If there are no existing solutions, what is the state of the art (i.e., current research papers, etc)?