The interpreter executes RoboProgram (from RoboExecutable) as a plain C# loop over fake IL. It does not JIT to CLR IL or use reflection for user code.
RoboInterpreter: Run-to-completion API over a program, world, andTextWritertargets for stdout/stderr.RoboInterpreterSession: Holds engine state for stepping / sessions (used when hosts need pause boundaries).
Shared execution logic lives in RoboInterpreterEngine (internal): initialize, then ExecuteNext for one instruction.
Matches v1-runtime-spec.md:
- Deterministic: No threads, timers, or hidden randomness in v1.
- Result-driven: Normal failures are
RuntimeFault/ExecutionResult, not thrown exceptions for user-level mistakes (some defensiveInvalidOperationExceptionpaths may still map to faults in the engine).
Each ExecuteNext:
- Bounds-check the current instruction pointer.
- Fetch the current
Instruction. - Dispatch on
RoboOpcode. - Mutate evaluation stack, locals, heap arrays, world, or writers as defined for that opcode (il-instruction-set.md).
- Return
nullto continue,ExecutionResult.Completedwhen the call stack is drained, orExecutionResult.Failedon fault.
The v1 spec describes one evaluation stack per call frame. The current engine uses a single shared stack with frame metadata; behavior remains stepable and teaching-friendly, but deep stack inspection UIs should be aware of the difference when showing “operand stack per frame.”