← Back to DevLog

June 12, 2026 · By Kaleb de Souza, Core Architect · 6 min read

Why We Chose a Triple Execution Model for Dryad

When designing a programming language, creators usually face a rigid trade-off: do they build a fast-looping dynamically-interpreted scripting tool (like Python/JavaScript) or a rigid statically-compiled high-performance system (like C++ or Rust)?

During early specifications of Dryad, we realized this trade-off is often artificial. Modern developers want fast startup loops during initial code iteration, robust interactive debuggers, and optimal production-level builds. To solve this, Dryad introduces the Triple Execution Architecture:

  1. The Tree-Walking AST Interpreter: This executes directly off the parsed syntax tree. It requires zero compilation time. If you run a simple micro-task, the interpreter starts instantly and runs with robust local variable reflection. It is ideal for debugging and fast sandbox runs.

  2. The Stack-Based Bytecode VM: By calling set_compile_mode(true), the runtime quickly lowers the AST nodes into a compact stream of bytecode operations (OpCodes) like LOAD_CONST, ADD, STORE_LOCAL. It executes sequentially inside a high-speed dispatch loop that has up to 10x faster iteration speeds than raw tree-walking.

  3. The experimental AOT Compiler: Using code marked with 'use strict types', the VM's Intermediate Representation (IR) is mapped into direct register-allocated instructions. This compiler compiles the bytecode into native machine code (ARM64 and x86_64) packaged inside standard executable ELF (Linux) or PE (Windows) binaries, removing the runtime VM overhead entirely.

This tiered pipeline means you can compile what you need, when you need it, matching Python's ease of use while keeping paths open for C++'s bare-metal velocity.

Compilers·Virtual Machines·AOT·Performance