Here is a sample run:
$ cat hello.imc .pcc_sub _main prototyped .include "DWIM.imc" add $I0, 20, 22 print $I0 print "\nHello Parrot!\n" end .end
$ parrot hello.imc 42 Hello Parrot!
$ cat hello.imc .pcc_sub _main prototyped .include "DWIM.imc" # DWIM $I0, 20, 22 # DWIM $I0 # DWIM "\nHello Parrot!\n" # DWIM .end
$ parrot hello.imc 42 Hello Parrot!
So during the first run, the DWIM lib replaces all these nasty opcodes, which no one can remember, with the much more handsome DWIM comment.
This makes for much simpler code: just fill in the proper operands.
I should clean up and comment it a bit, then I could submit it - where? runtime/parrot/lib ?
Have fun, leo