PIR did parse since quite a time instructions like:

  $I0 = defined $P0[0]
  $P1 = clone $P2

but these were handled with explicite rules. And I found me often writing:

len = length $S0

which wasn't a valid syntax.

I've now tossed the special handling of defined and clone. Instead PIR allows now generally to write

lhs = PARROT_OP args

so these instructions:

    $I0 = defined a
    $I0 = defined a[0]
    b = clone a
    $I0 = length s
    $N0 = sin 0
    $I0 = can $P0, "puts"
    $I0 = isa $P0, "scalar"

are now (amongst many more) valid PIR syntax. There are currently no checks, if this instructions is something meaningfull too. It's just converted to

PARROT_OP lhs[, args]

So you can write:

$I0 = add 10, 20

or even:
.sub _main
    $P0 = find_global "_s"
    $P0 = invokecc
    $S0 = "done\n"
    $S0 = print
    end
.end
.sub _s
    print "in sub\n"
    P1 = invoke
.end

where it really gets ugly. We could of course limit this syntax to more useful constructs.

leo



Reply via email to