On Dec 10, 2005, at 13:29, Shane Calimlim wrote:

You can see the generated PIR here: http://theguildforge.com/ack.pir

Indeed nice code already. You can also get rid of "subtract", "concat" et al by using the n_infix opcodes:

$ cat x.pir
.sub main :main
    .local pmc x,y,z,s
    x = new .Integer
    y = new .Integer
    y = -3
    z = n_sub x, y     # create new lhs
    print_item z
    s = n_concat x, y  # same
    print_item s
    print_newline
.end

or automatically:

$ cat x.pir
.pragma n_operators 1
.sub main :main
    .local pmc x,y,z,s
    x = new .Integer
    y = new .Integer
    y = -3
    z = x - y     # create new lhs
    print_item z
    s = x . y     # same
    print_item s
    print_newline
.end

$ ./parrot x.pir
3 0-3

leo

Reply via email to