diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-26 09:15:29 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-26 09:15:29 +0200 |
| commit | dd9ac5799b04746d3d7de21d5c3ea79b5cc6ace6 (patch) | |
| tree | 4f493455e739baee4e0dfe99d0e5acec0d23309b | |
| parent | c5fe517d58df75acf33130e4bc20057b127934c4 (diff) | |
delete plan
| -rw-r--r-- | PLAN.md | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/PLAN.md b/PLAN.md deleted file mode 100644 index 798bcb2..0000000 --- a/PLAN.md +++ /dev/null @@ -1,39 +0,0 @@ -# Overall Plan for Implementing Variable Symbol Handling in gt - -## Goal -Modify the gt interpreter so that: -1. Users can push a variable *symbol* onto the stack using `:x` syntax. -2. Bare identifier `x` pushes the symbol when the variable is unbound, otherwise pushes its value. -3. Existing assignment operators `:=` and `=:` remain unchanged (they will receive either a symbol from `:x` or from an undefined identifier). - -## Changes Required - -### 1. Lexer -- Recognize a leading colon (`:`) followed by an identifier as a `TOKEN_SYMBOL`. -- When seen, push a `CELL_SYMBOL` cell holding the identifier string onto the stack. - -### 2. Evaluator (identifier handling) -- For a bare identifier token: - - Attempt `env_get(name)`. - - If a binding exists → push the value cell. - - If no binding exists → push a `CELL_SYMBOL` cell (treat as symbol). - -### 3. Assignment Operators -- Keep `:=` and `=:`) handlers unchanged. -- They now receive either a symbol cell (from `:x` or from undefined identifier) and a value cell in the expected order. - -### 4. REPL / Debugging -- When printing the stack, prefix symbol cells with `:` (e.g., `:x`) to distinguish from values. - -### 5. Testing -- Verify the behavior with a test suite covering: - - `:x` pushes symbol. - - `x` unbound → pushes symbol. - - `x` bound → pushes value. - - `:x 10 :=` binds x to 10. - - `10 :x =:` binds x to 10 (value‑first). - - Error cases where needed. - -## Tasks (managed via `ask`) -Each task below will be added via `ask add` and tagged with `plan:PLAN.md` for traceability. - |
