Skip to content

Simplify runtime architecture: Interpreter becomes the running program#84

Merged
figgleforth merged 7 commits intomainfrom
runtime-refactor
Apr 5, 2026
Merged

Simplify runtime architecture: Interpreter becomes the running program#84
figgleforth merged 7 commits intomainfrom
runtime-refactor

Conversation

@figgleforth
Copy link
Copy Markdown
Owner

Summary

  • Removes the Program/Stage pipeline abstraction and the separate Runtime class — replaced by a single Interpreter that owns everything
  • Interpreter is now the sole entry point: it holds lexer, parser, and all execution state (stack, routes, servers, loaded_files, etc.) directly, and exposes run(source_code)
  • Global < Scope goes back to a plain empty subclass, and becomes the first scope pushed to stack on first run

What changed

Before: Five moving parts — Stage, Program, Runtime, Global, Interpreter — with circular ownership (Runtime owned ~Interpreter, Interpreterheld@runtime`) and two separate code paths for interp vs interp_file.

After: Three plain classes — Lexer, Parser, Interpreter. Interpreter.new.run(source) is all a caller needs. Lexer and Parser can still be called directly for partial pipeline use.

- Removed Pipeline, Stage
- Made Interpreter the main program with it's own instances of lexer, parser, runtime
- Simplified Runtime
- Update tests
Interpreter now has the methods that used to be in the Runtime class.
Runtime is both a scope and the main scope with the stack. It itself is the first scope in its stack. Weird? Maybe. Tests pass.

This simplifies the mental model to just Interpreter and its subsystems.
The stack, server map, database map, etc, used to be in a class Runtime. Now that functionality is directly in Interpreter.

Makes Interpreter the main running program. Don't have to think about calling .runtime anywhere.

All tests pass.
@figgleforth figgleforth merged commit 4755fc3 into main Apr 5, 2026
1 check passed
@figgleforth figgleforth deleted the runtime-refactor branch April 5, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant