Skip to main content

Module bytecompiler

Module bytecompiler 

Source
Expand description

Boa’s bytecode compiler.

The bytecompiler is responsible for lowering ECMAScript AST nodes into executable bytecode for the virtual machine.

It walks the parsed AST and emits instructions using the bytecode emitter, producing code blocks that are later executed by the VM.

This module provides the necessary functionality to compile JavaScript code into bytecode. Conceptually, it is the bridge between the spec’s runtime semantics and Boa’s opcode-based VM. When the ECMAScript algorithms use the ! prefix for an abstract operation, Boa treats the corresponding assumption as an internal compiler or bytecode invariant, and documents that mapping near the assertion sites that rely on it.

Relevant specification entry points include script evaluation, module evaluation, and the expression and statement runtime semantics that eventually feed into those top-level algorithms.

Structs§

ByteCompiler
The ByteCompiler is used to compile ECMAScript AST from boa_ast to bytecode.