TXL-like capability?

S

SomeDeveloper

Hello,

Can I do source to source transformations elegantly in Perl?

I'm a compilers and TXL newbie, but as I'm reading more about TXL, I'm
seeing that what it provides at the end of the day is:
1. the ability to define/specify arbitrary grammars, and
2. the ability to specify semantic actions (for grammar
productions) via search/replace patterns.

Since Perl is the king of regex's, I'm wondering where I can stay
within Perl for all my source to source transformation needs.

Regards,
Some Developer
 
S

SomeDeveloper

Check out the Filter module on CPAN:

<http://search.cpan.org/~pmqs/Filter-1.34/perlfilter.pod>

sherm--

Thanks, but this is not what I'm looking for. Among other things TXL
lets you, e.g., transform a simple Pascal program into an equivalent C/
C++ program, identify certain language constructs via its grammar and
re-write their better or different versions, etc.

Only because its modus operandi is via regex patterns and their
replacements, is why I asked whether or not the same thing could be
done in Perl.

My question is still open.
 
P

Peter J. Holzer

Can I do source to source transformations elegantly in Perl?

I'm a compilers and TXL newbie, but as I'm reading more about TXL, I'm
seeing that what it provides at the end of the day is:
1. the ability to define/specify arbitrary grammars, and
2. the ability to specify semantic actions (for grammar
productions) via search/replace patterns.

Since Perl is the king of regex's,

Regexes (even perl regexes, which are more powerful than regular
expressions) are not sufficient to specify arbitrary grammars.

Assuming that by TXL you mean the programming language available from
http://www.txl.ca/, they use BNF to specify the grammar, not regexes.
I'm wondering where I can stay
within Perl for all my source to source transformation needs.

You can use Parse::RecDescent to build parsers from a BNF-like
description.

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top