in reply to Code Structures
Actually, there's already a standard format, at least with Perl--the bytecode--though that doesn't matter so much. The same problem holds for any such representation.
The problem with translating from some standard representation to different code structures is that there may be a large (perhaps infinte) number of structures that can be represented in the same way. This could be alleviated somewhat by expressing preferences of certain kinds of structures, but there's no guarentee that the produced code will be at all readable. Conversely, there are highly similar code structures that may be represented in vastly different ways.
You also have to consider different definitions of "code structure". Is the way I choose to factor code into subs a structure? If I determine odd-ness with $foo & 1 and you do it with $foo % 2, is that a translatable code structure? This falls apart particularly in the face of operator overloading, in which there's no way to determine semantic equivalence of % 2 and ^ 1.
Language translation is hard, even if you're starting and ending in the same language.
|
|---|