There is of course no "eval" in Parrot. Anyway:

* the signature of a Parrot compiler PMC is now "PIt" - it returns
a Sub PMC directly - or more precisely an Eval PMC, which is a
Closure
* attached onto this Closure is the compiled bytecode
* this Closure's are named EVAL_n (n = 1...)
* it can (or has to) be invoked like any other sub according to calling conventions.
* this also means that the compiled code has to end with "invoke P1".
* compiled code that just "end"s terminates the run-loop
* the compiled code has the life-time of the returned Sub PMC


TODOs:
* implement the @MAIN and @LOAD pragmas
* provide an @ANON pragma, so that globals are not effected by compiled
   subroutine names
* adjust imcc tests
* cleanup

The forth compiler snippet works with s/end/invoke P1/ for the compiled code.

see t/pmc/eval.t for examples

leo



Reply via email to