Pretend I have the following:
Context free grammars C1 and C2 for two programming languages.
A mapping M between some of the symbols of C1 and C2
An algorithm A that will use C1, C2 and M to convert a string S1 generated by C1 to a string S2 generated by C2. I haven't worked out the details of the algorithm, but I'm imagining something that would try to generate S2s making the minimal number of assumptions (i.e. S2 should have the minimal number of nodes in its parse tree). There are certain inferences that can be made with certainty, for example terminal to terminal mappings. Another more complex example would be if non-terminal X maps to non-terminal Y, and if all the symbols in the group X generated map to symbols in one of Y's groups, we can infer that Y generates that group.
My question: Can A be used as a compiler? If so, what can it compile?
Edit: Fixing symbol collision.
