Croquet-Tweak compiler chain "working"
gettimothy via Squeak-dev <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
summary via Claude.ai posted below inline # Tweak Port — Session 4 Handoff Briefing **Date:** Monday, May 25, 2026 **Image:** `shared/old/11.image` / `11.changes` --- ## The Big Win This Session **`CCompiler evaluate: '3 + 4'` → `7`** The CCompiler Facade over the standard Squeak compiler is now working. This was the architectural pivot Eliot Miranda advised — make CCompiler a front-end for the standard Squeak compiler rather than using the full parallel Tweak C-node code generation pipeline. --- ## Image Checkpoints | Image | State | |-------|-------| | `9.image` | Session 3 baseline (Tweak packages partially loaded) | | `10.image` | `CCompiler superclass: Compiler` — Facade skeleton | | `11.image` | **CCompiler Facade fully operational — `7` confirmed** | **Working image:** `shared/ClaudeTweak.image` (= `11.image`) --- ## What Was Accomplished This Session ### Infrastructure - Restored `9.image` → `ClaudeTweak.image` (previous sessions had drifted) - Installed MCP-TCP server v3.0 in the image - Confirmed Claude Code (GPTEL + Emacs → MCP:9877 → Squeak) fully operational - Saved `10.image` and `11.image` checkpoints ### The CCompiler Facade — Full Fix History **Step 1:** `CCompiler class >> initialize` neutralized (was `self recompileAll` — would have destroyed everything) **Step 2:** `CCompiler superclass: Compiler` CCompiler now inherits the modern Squeak compilation pipeline. **Step 3:** `CCompiler class >> new` already wired `parserClass: CParser` ✅ **Step 4:** `CParser` node factory methods verified clean (Session 3 had already replaced all C-nodes with standard nodes in the 9 key methods) **Step 5:** `CParseNode compile: 'is: aNode ^ self == aNode'` Added missing `is:` to root C-node class so standard nodes can hold C-node children. **Step 6:** `CParser >> encoderFromCue:` fixed Was creating `CEncoder`; now uses `(aCompilationCue encoderClass ifNil: [...]) new` **Step 7:** `CParser >> parse:class:category:noPattern:context:notifying:ifFail:` fixed Was hardcoding `CEncoder new init: class context: ctxt notifying: parser`; Now: `EncoderForSistaV1 new init: (CompilationCue class: class) notifying: parser` **Step 8:** `CCompiler >> setCue:` made safe Now only calls `getClass` if aCue is a CompilationCue instance. **Step 9:** `CCompiler >> evaluate:in:to:notifying:ifFail:logged:` modernized Replaced old DoIt-installation approach with modern `evaluateCue:ifFail:logged:` delegation. **Step 10:** `CCompiler >> from:class:context:notifying:` fixed Was setting raw ivars bypassing the cue system; now calls `self setCue: (CompilationCue ...)`. **Step 11:** `MethodProperties >> propertyKeysAndValuesDo:` and `pragmasDo:` added Two missing methods discovered and added during parsing pipeline debugging. **Step 12: THE KEY FIX — `CCompiler compileAll`** After `CCompiler superclass: Compiler`, all CCompiler methods had stale bytecode slot indices (duplicate `cue` and `parser` ivars from both classes). `CCompiler compileAll` recompiled everything with correct indices. **This was the final fix that made `3 + 4 → 7` work.** --- ## Current State of CParser CParser now produces **standard Squeak AST nodes** (not C-nodes) for the core cases: - `newMethodNode` → `MethodNode new` - `statements:innerBlock:` → `BlockNode`, `ReturnNode` - `messagePart:repeat:` → `MessageNode` - `remoteAssignment` → `MessageNode` - `matrixExpression:` → `MessageNode`, `BlockNode` The C-node class hierarchy (27 classes rooted at `CParseNode`) is still present in the image as a parallel hierarchy, but CParser's output goes to standard nodes which the standard Squeak encoder handles correctly. --- ## Known Remaining Issues - `CParseNode >> is:` added as a bridge — C-nodes can appear as children of standard nodes without MNU - `TextMorphEditor` undeclared in `parse:class:category:...` — harmless warning, that branch simply never fires - `compileNoPattern:in:context:notifying:ifFail:` (5-arg legacy version) still uses old `translate: sourceStream` path — not hit in current evaluate path but may need attention during fileIn - `<field:>` and `<slot:>` structural pragmas not yet handled — deferred to Tweak-Costume / Tweak-Basic loading stages --- ## Next Session Goals 1. **Verify `CCompiler compile:in:classified:notifying:ifFail:`** works (method compilation, not just expression evaluation) 2. **Attempt fileIn of `Tweak-Core-Object-tty.20`** — this was the blocking package at the end of Session 2 3. Continue the load order: - Tweak-Core-Object-tty.20 ← PRIMARY TARGET - Tweak-Costume-tty.80 - Tweak-Basic-tty.131 - Tweak-Platforms-tty.16 - Tweak-Widgets-tty.153 - Tweak-Morphic-tty.37 - Tweak-Projects-tty.58 - Tweak-ToolBuilder-tty.3 --- ## Key Files | File | Purpose | |------|---------| | `shared/ClaudeTweak.image` | Working image (= 11.image) | | `shared/old/11.image` | Session 4 milestone checkpoint | | `/home/wm/usr/src/smalltalk/package-croquet-cache/` | Package cache | | MCP port 9877 | Claude Code eval endpoint | | WebServer port 8082 | HTTP eval endpoint | --- ## Environment - **Image:** Squeak 6.1 alpha 64-bit - **MCP:** TCP v3.0.0 on 127.0.0.1:9877 - **Claude Code:** GPTEL (Emacs) → smalltalk_task → MCP → Squeak - **Start command:** `start-image.sh --name ClaudeTweak --port 9877 --morphic` --- *Session 4 — May 25, 2026* *Collaborators: Timothy (human), Claude Sonnet 4.6 (claude.ai), Claude Code (GPTEL/Emacs)* the ` - **Start command:** `start-image.sh --name ClaudeTweak --port 9877 --morphic` enables the GPTEL communication bridge with the running squeak image...(it burns though tokens...fyi) Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]