speedyshady:

I've had to do similar language translations before. As mentioned previously, doing it perfectly is a rather large job. However, it's often easy to get an 85%+ solution working fairly simply. If you're the one writing the 4Test code, then it's even simpler, as you can avoid many constructions that you have difficulty translating.

The way I've handled it in the past is to learn to recognize certain items, and translate them. Start with the simplest. Feel free to make assumptions[1]. Then, during your translation process, print anything untranslatable to the screen, so you can see what construction to attack next. I generally choose either the most frequently-seen item on the screen or the simplest one among those remaining.

Then, as your program evolves, you'll fix broken assumptions, restructure parts of your code to do a better job, etc. You'll also find a good place to stop--after all, unless (a) you're really good, (b) you have plenty of spare time, and (c) you have no life, you'll eventually stop improving it. You'll likely have to translate a few things by hand here and there.

...roboticus

[1] You might, for example, choose to assume that expressions fit on a single line. If you normally code that way, you can probably get away with it for a good while.


In reply to Re: Parsing and Translation by roboticus
in thread Parsing and Translation by speedyshady

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.