Parrot Parrot Compiler Toolkit #15

Dynamic compilation

Compilers are built-in components of Parrot

$S0 = "...my python program..."
$P0 = compreg 'Python'           # get the Python compiler
$P1 = $P0.'compile'($S0)         # compile code in $S0
$P1()                            # execute it

or

freeze "myprog.pbc", $P1         # save bytecode to disk
Copyright © 2009
http://www.pmichaud.com/2009/pres/