|Pattern 26||Bytecode Assembler|
This pattern translates a text-based human-readable assembly language program into binary bytecode instructions.
The assembly language instruction set accepted by this pattern is reprogrammable (it isn’t fixed) and handles both stack-based and register-based instructions.
Bytecode interpreters feed off low-level byte arrays full of bytecodes (operation codes that fit into a byte) and integer operands. Generating raw bytecodes from a bytecode compiler is an extra burden on an already complex compiler. It’s easier to generate text-based assembly code and then have an assembler convert that to machine code. In other words, rather than generating bytes 14, 0, 0, 0, 0, and 21, it’s easier to generate ...