tracing HLL compiler actions

bsdz blairuk at googlemail.com
Fri Feb 13 22:22:00 UTC 2009


Hi

I am attempting to write a language and need to trace what is
happening in my actions.pm methods.

I have tried writing 2 similar rules based on Squak: -

rule func_def {
    'func' <identifier> <parameters>?
...

and

rule func_def2 {
    'func' <identifier> <parameters>
...

When I compare the parse tree targets I noticed the first
implementation wraps my  <parameters> node into a ResizablePMCArray.
So I am guessing if I leave out parameters in my code then I will
still get an empty $<parameters> key in my $/.

So I am wondering if I should test the existence of parameters in my
action.pm with: -

if $<parameters> { ...

or

if $($<parameters>) > 0 { ...

Is there any way I can get the compiler to send a trace statement to
the console something along the lines of "say $/" or otherwise. I have
noticed a "--trace" option but couldn't find the relevant docs.

Thanks
Blair



More information about the parrot-dev mailing list