Package org.cloudburstmc.mojava.compiler
Class BytecodeCompiler
java.lang.Object
org.cloudburstmc.mojava.compiler.BytecodeCompiler
Compiles a parsed Molang AST into a JVM class implementing
MoScript. The emitted
bytecode delegates all fiddly semantics to CompilerSupport; this class is responsible only
for control flow, value flow, and constant handling.
Discipline that keeps COMPUTE_FRAMES happy: every node's compile leaves exactly
one value typed as MoValue on the stack, so the frame merger never has to find a common
supertype of two concrete value classes (which would collapse to Object and break later
interface calls).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThrown at compile time for an expression that violates Molang's type rules in a way detectable from the source alone — currently, a string literal used anywhere except==/!=.static final classThrown when a node can't be compiled; the caller should fall back to interpretation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MoScriptcompile(List<Expression> expressions) static byte[]compileToBytes(List<Expression> expressions) Emits the class bytes for a script without loading them.
-
Constructor Details
-
BytecodeCompiler
public BytecodeCompiler()
-
-
Method Details
-
compile
-
compileToBytes
Emits the class bytes for a script without loading them. Intended for tests/verification.
-