Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:
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);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Language Conversion
by ikegami (Patriarch) on Sep 09, 2009 at 16:38 UTC | |
by waswas-fng (Curate) on Sep 09, 2009 at 18:47 UTC | |
by Steve_BZ (Chaplain) on Sep 09, 2009 at 21:53 UTC | |
by ikegami (Patriarch) on Sep 09, 2009 at 21:58 UTC | |
Re: Language Conversion
by halfcountplus (Hermit) on Sep 09, 2009 at 15:41 UTC | |
by Bloodnok (Vicar) on Sep 09, 2009 at 16:03 UTC | |
by almut (Canon) on Sep 09, 2009 at 17:10 UTC | |
by halfcountplus (Hermit) on Sep 09, 2009 at 20:28 UTC |