I wrote a little macro (in Komodo) to convert some VBScript subroutines to Perl (see below). It missed a few things, but then executing the Perl in the debugger soon got it working and it was much quicker than converting by hand. I wondered if anyone else has written routine to translate between other languages. Specifically, I'm looking for something to take the pain out of converting a few subroutines into C or C++ for my current Perl project for security reasons.

Here it is:

// Macro recorded on Thu Aug 13 2009 22:13:22 GMT-0300 komodo.assertMacroVersion(2); if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focu +s(); } Find_ReplaceAllInMacro(window, 1, '\'', '#', true, 0, 2, true, false); Find_ReplaceAllInMacro(window, 0, '\'', '#', true, 0, 2, true, false); Find_ReplaceAllInMacro(window, 0, 'If', 'if (', true, 0, 2, true, fals +e); Find_ReplaceAllInMacro(window, 0, 'then ', ') {', true, 0, 2, true, fa +lse); Find_ReplaceAllInMacro(window, 0, 'then', ') {', true, 0, 2, true, fal +se); Find_ReplaceAllInMacro(window, 0, 'End If', '}', true, 0, 2, true, fal +se); Find_ReplaceAllInMacro(window, 0, 'End if', '}', true, 0, 2, true, fal +se); Find_ReplaceAllInMacro(window, 0, 'End IF', '}', true, 0, 2, true, fal +se); Find_ReplaceAllInMacro(window, 0, 'Else', '} else {', true, 0, 2, true +, false); Find_ReplaceAllInMacro(window, 0, 'Function', 'sub', true, 0, 2, true, + false); Find_ReplaceAllInMacro(window, 0, 'Fn_', '__', true, 0, 2, true, false +); Find_ReplaceAllInMacro(window, 0, 'Loc_', '$loc_', true, 0, 2, true, f +alse); Find_ReplaceAllInMacro(window, 0, 'Len(', 'length(', true, 0, 2, true, + false); Find_ReplaceAllInMacro(window, 0, 'Mid(', 'substr(', true, 0, 2, true, + false); Find_ReplaceAllInMacro(window, 0, 'mid(', 'substr(', true, 0, 2, true, + false); Find_ReplaceAllInMacro(window, 0, 'Left(', 'substr(', true, 0, 2, true +, false); Find_ReplaceAllInMacro(window, 0, 'true', '1', true, 0, 2, true, false +); Find_ReplaceAllInMacro(window, 0, 'TRUE', '1', true, 0, 2, true, false +); Find_ReplaceAllInMacro(window, 0, 'false', '0', true, 0, 2, true, fals +e); Find_ReplaceAllInMacro(window, 0, 'FALSE', '0', true, 0, 2, true, fals +e); Find_ReplaceAllInMacro(window, 0, '<>', '!=', true, 0, 2, true, false) +; Find_ReplaceAllInMacro(window, 0, ' mod ', ' % ', true, 0, 2, true, fa +lse);

In reply to Language Conversion by Steve_BZ

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.