C
Chris Wright
Is there a way to go from the AST output of compiler.paser to byte
code
i.e. in the example below, is there a way to compile m and get a code
object that could then be called?
cheers and thanks for the help
chris wright
.... def test(x):
.... y = x + 1
.... print x, y
.... """Module(None, Stmt([Function('test', ['x'], [], 0, None,
Stmt([Assign([AssName('y', 'OP_ASSIGN')], Add((Name('x'), Const(1)))),
Printnl([Name('x'), Name('y')], None)]))]))
code
i.e. in the example below, is there a way to compile m and get a code
object that could then be called?
cheers and thanks for the help
chris wright
.... def test(x):
.... y = x + 1
.... print x, y
.... """Module(None, Stmt([Function('test', ['x'], [], 0, None,
Stmt([Assign([AssName('y', 'OP_ASSIGN')], Add((Name('x'), Const(1)))),
Printnl([Name('x'), Name('y')], None)]))]))