Once the generator has processed the AST, it needs to properly encode the bytecode. This stage is very simple, and is mostly for recordkeeping.
The Encoder stage is responsible for two things:
bytecode) into an instruction sequence.
It performs these steps on the main Generator object, as well as any child Generators (generators for blocks, methods or other structures encountered inside of the main body).
Once this stage is complete, it passes the encoded Generator object to the next stage, the Packager stage.
encodemethod in the file performs the bulk of the work in this stage.
Since this stage is so simple, you will not need to customize it. You might want to instrument it (for instance, for profiling or printing). To learn more about general-purpose customization, which you can use to instrument any stage, check out Customizing the Compiler Pipeline.