http://www.perlmonks.org?node_id=380918

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I'm about to begin a large project of porting half a million lines of old 4D business logic to perl (4D's language is similar to PASCAL, but with more database features). I've written a code converter using regular expressions that does a pretty decent job, but I'm having trouble making it much better.

It seems that the best way to do such a project would be to parse the legacy code into a tree-structure and then build the perl code up from that tree. Has this been your experience? And more importantly, which tools (CPAN or otherwise) would you recommend to make this process easier. I've seen Parse::RecDescent; is this the best tool for this project?

My goal isn't to generate perfect code, only code that requires the least debugging. Also, if you have any general suggestions about writing a code translator, let me know that too.

Thanks so much,

Andrew