generating byte code from compiler.parse output

Martin v. Löwis martin at v.loewis.de
Fri Aug 8 01:56:57 EDT 2003


caw at cs.mu.oz.au (Chris Wright) writes:

> Is there a way to go from the AST output of compiler.paser to byte
> code

Yes. Use the source, Luke.

> i.e. in the example below, is there a way to compile m and get a code
> object that could then be called?

You have to find out what compiler.compile is doing in addition to
what you are doing. Then, you find, that you need misc.set_filename,
syntax.check, ModuleCodeGenerator, and .getCode, in that order.

HTH,
Martin




More information about the Python-list mailing list