Michal Wallace <[EMAIL PROTECTED]> wrote:

> Could you serialize a parrot function?

> In other words, if you interactively define a
> function at the prompt, could you save it to
> disk? (not the source code, the actual binary
> representation of the function?)

Yes. Its almost done. It needs some more work in the packfile, changes
to innvoke (to switch packfiles on the fly) and one opcode to load the
PBC. When you want to save PMCs too, it'll be more work.

> Does this work out of the box? If not, does anyone
> have any idea how to even approach this problem?

eval.pmc:get_string() returns a packed PBC, ready to go to disc.

$ cat languages/parrot_compiler/parrot.pasm
  read S0, 1000000
  compreg P1, "PASM"
  compile P0, P1, S0
  write P0
  end

(read a PASM program from STDIN to S0, compile that with the PASM
compiler and write the resulting PBC to STDOUT, thanks again to Juergen
Boemmels for providing this idea)

> Sincerely,
>
> Michal J Wallace

leo

Reply via email to