Syntax for PAST Optimizations

Allison Randal allison at parrot.org
Mon May 31 12:59:10 UTC 2010


On 5/31/10 12:40 PM, Allison Randal wrote:
>... or something completely new and different.

The extra mile is syntax that's actually pleasant to work with.

transform as_post PAST::Op
   where pirop is 'add'
     and children.count is 2
     and children.returns are ('PAST::Val' or 'PAST::Var')
to POST::Op
   with name     = tree.name,
        pos      = tree.pos,
        children = (tree.left.as_post, tree.right.as_post)


rewrite op PAST::Op
   where pirop is 'add'
by { running this code }


rewrite op PAST::Op
   where (pirop is 'add')
to PAST::Op
   with name = tree.name,
     # ... other different characteristics

(Note: 'is' is a single value, 'are' is an iterator.)

Allison


More information about the parrot-dev mailing list