Hacker News new | ask | show | jobs
by thomaslee 4812 days ago
Interesting extension of this exercise would be to replace your custom AST with the AST exposed by Python, then use the compile() builtin to compile said AST into a PyCodeObject ready for direct execution by the Python VM. :)

Something along these lines: https://github.com/thomaslee/viking-poc/blob/master/viking#L...

(Disclaimer: I wrote the Python-AST-to-PyObject transformation code for Python 2.6 that made this sort of stuff possible -- fun hack!)