Bytecode: instructions for Ignition
How the bytecode generator turns an AST into instructions for Ignition.
Bytecode contains compact instructions for the Ignition interpreter. They describe the operations to perform: obtain a value, add numbers, call a function, or return a result.
ParserBuilds the AST
→Bytecode generatorAST → instructions
→IgnitionExecutes instructions
function add(a, b) {
return a + b;
}
For this function, the generator produces instructions whose meaning is: obtain a, add b, and return the result. Bytecode describes these operations; Ignition executes them.
In the next lesson we will step through these instructions and see how the result changes.