If there is a generic format available like XML for code, translating code structures would be very easy.

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.


In reply to Re: Code Structures by Anonymous Monk
in thread Code Structures by artist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.