Class BytecodeCompiler

java.lang.Object
org.cloudburstmc.mojava.compiler.BytecodeCompiler

public final class BytecodeCompiler extends Object
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).

  • Constructor Details

    • BytecodeCompiler

      public BytecodeCompiler()
  • Method Details

    • compile

      public static MoScript compile(List<Expression> expressions)
    • compileToBytes

      public static byte[] compileToBytes(List<Expression> expressions)
      Emits the class bytes for a script without loading them. Intended for tests/verification.