Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

coke (5373)

  (email not shown publicly)

Journal of coke (5373)

Friday January 06, 2006
12:25 PM

better partcl compilation framework

[ #28267 ]

partcl is still failing a few tests, but things are looking up. Fixed a bug that was bringing down our tcl test suite numbers, added regression tests to tcl to track them. Also did some expr cleanup (octal, ~ operator, more tests.)

In the past few days, added a build tool that lets us declare inline'd tcl builtins (originally, everything was interpreted. Now several commands have a version that generates PIR), rather than hand rolling them. this lets you declare the argument types (and whether they are optional, default values, etc.) and have them compiled automatically, and just define the small bit of PIR code that you need to process the arguments. It also automatically generates errors for bad calls, etc.

By moving all this setup code into the build script, we should lower the bar for implementing the builtins. as of this writing, six builtins have been converted to the new template style. Here's a sample:

    command => 'join',
    args =>
            name => 'list',
            type => 'list',
            name => 'joinString',
            type => 'string',
            optional => 1,
            default => " ",
    code => <<'END_PIR',

$S{register_joinString} = $P{register_joinString}
$S{register_num} = join $S{register_joinString}, $P{register_list}
$P{register_num} = new .TclString
$P{register_num} = $S{register_num}

Most of the declaration is pulled right from the manpage, as far as arguments go. The actual PIR code that does the work is actually a bit longer than it needs to be, due to boxing. (The compiler currently assumes that the result of the compilation is always a PMC - being able to specify a specific register as opposed to a PMC will let us reduce the amount of code even further.)

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