>>224When running a python program, the following steps are taken:
Python source code -> abstract syntax tree (AST) -> bytecode
Hy replaces the "Python source code -> AST" step.
We should note that bytecode is an implementation detail.
CPython has its own format, Jython compiles to JRE bytecode, and other implementations can use more complicated means such as running and compiling simultaneously (JIT compilation).
>>226>Maybe they do it like this because there's no portable bytecode format?It's simpler if you just replace the "source code -> AST" step.
AST is the ideal model to compile your code to
because it is the same level of abstraction as it's input (source code).
You can easily see create and run your own AST with python's ast library.
It's pretty trivial to even implement a simple language yourself using that library.