Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chromatic (983)

chromatic
  (email not shown publicly)
http://wgz.org/chromatic/

Blog Information [technorati.com] Profile for chr0matic [technorati.com]

Journal of chromatic (983)

Thursday January 31, 2008
05:42 PM

Minor Irony

[ #35543 ]

I hate writing parsers, but much of the work Allison's asked me to do to revise the PMCs in Parrot has required modification and extension of a parser written in Perl 5 to turn our little language for describing PMCs into compilable C code.

The other day I realized that I could take 65 lines of generated code and turn it into 1 line of generated code by smartening the parser and re-using a function we already had elsewhere. It works for built-in PMCs, but I think there may be a failure case for dynamic PMCs (though fixing that is fairly easy and will provide a nice speed improvement there too).

After thinking about the problem for a while, I decomposed the problem into a couple of function calls that transformed the data I had into the data I needed. I didn't actually write the functions; I merely wrote their names, passed in their arguments, and received the data they returned. After dinner, I started writing the functions.

Everything went well, until I realized that I had to keep looking back and forth at the functions and de-facto signatures (this is Perl 5 code) to remember what I passed in and what I received.

Score one for explicit signatures like you find in C.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.