Perl-to-Python converter/translator?

Grant Griffin not.this at seebelow.org
Fri Feb 2 13:31:13 EST 2001


In article <mailman.981100210.20770.python-list at python.org>, "Tim says...
>
>[Grant Griffin]
>> ...
>> To rigorously and correctly translate any-and-all Perl to Python
>> would surely take a heroic effort, but to do it at about the
>> 90% level can't be all that big of a job for the language
>> hobbyists out there (anybody know any? <wink>); ...
>
>Sorry, Grant:  simply *parsing* Perl is beyond most peoples' pain tolerance;

It sure was beyond _mine_, Tim!  Luckily, just about the time I realized I
couldn't parse my own Perl code, I discovered Python <wink>.

But this is a classic Catch-22: you switch to Python because you found yourself
unable to maintain your own Perl; you want to translate your Perl to Python so
you can maintain it; but there aren't any automatic translators out there
because nobody _else_ can figure out how to parse Perl--which is more-or-less
why you switched in the first place!

Then again, haven't Great Minds already solved the parsing part of automatic
translation?  I mean, doesn't Perl come with its own lexer, parser, and even
grammar (though last I checked, they had to doctor the parser that was
automatically generated from the grammar...)

Which reminds me...I really think Open Source Software is gonna become a big
thing one day--just for cases like this <wink>.

>search CPAN for an equivalent to Python's tokenize.py and report back on
>your successes <wink>.

I see what you mean.  (Though to be fair, I never found tokenize.py on PYPAN
either <wink>.)

But did I say "translate at about the 90% level"?--I really meant translate at
about the _7%_ level.  If somebody came up with something that didn't really
"parse" Perl but just did the simple operation of "clutter-removal" (eliminating
";", "{", "@", "my", etc. outside of strings) that would help.

i'd-write-one-myself-if-perl-hadn't-taught-me-to-be-lazy
   -<wink>-ly y'rs,

=g2

_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation            http://www.iowegian.com




More information about the Python-list mailing list