about summary refs log tree commit diff stats
path: root/js/scripting-lang/baba-yaga-c/ROADMAP.md
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/ROADMAP.md')
-rw-r--r--js/scripting-lang/baba-yaga-c/ROADMAP.md83
1 files changed, 83 insertions, 0 deletions
diff --git a/js/scripting-lang/baba-yaga-c/ROADMAP.md b/js/scripting-lang/baba-yaga-c/ROADMAP.md
new file mode 100644
index 0000000..aba5e4d
--- /dev/null
+++ b/js/scripting-lang/baba-yaga-c/ROADMAP.md
@@ -0,0 +1,83 @@
+# Baba Yaga C Implementation - Focused Roadmap
+
+## Current Status
+- ✅ **Core Language**: Complete and stable (24/27 tests passing)
+- ✅ **Table Pattern Matching**: Fixed and working
+- ✅ **When Expressions**: Fixed and working
+- ✅ **Computed Table Keys**: Fixed and working (Task 1.1 complete)
+- ❌ **3 Remaining Issues**: Pattern expressions, table namespace, memory fixes needed
+
+## Implementation Plan
+
+### **Phase 1: Parser Extensions (High Impact)**
+
+#### **Task 1.1: Computed Table Keys** (Test 15) ✅ **COMPLETE**
+**Issue**: `{(1 + 1): "two"}` not supported
+**Solution**: Extended table key parsing with expression support
+**Implementation**: Added `TOKEN_LPAREN` detection and expression parsing logic
+**Result**: Test 15 now passes, 24/27 tests passing
+
+#### **Task 1.2: Multi-value Pattern Expressions** (Test 22) 🔄 **IN PROGRESS**
+**Issue**: `when (x % 2) (y % 2) is` not supported
+**Current**: Parse error - expression parsing consumes too many tokens
+**Next**: Implement bounded expression parsing or sequence pattern matching
+
+#### **Task 1.2: Multi-value Pattern Expressions** (Test 22)  
+**Issue**: `when (x % 2) (y % 2) is` not supported
+**Current**: Only literal patterns in multi-value
+**Fix**: Extend pattern parsing in `parser_parse_when_pattern`
+
+**Implementation Steps**:
+1. Modify pattern detection logic (lines ~2640-2670 in parser.c)
+2. Add support for `TOKEN_LPAREN` as valid pattern start
+3. Parse expression patterns using `parser_parse_expression`
+4. Test with `when (x % 2) (y % 2) is`
+
+### **Phase 2: Runtime Fixes (Medium Impact)**
+
+#### **Task 2.1: Table Namespace Debugging** (Test 17)
+**Issue**: `Error: Execution failed` in table operations
+**Current**: `t.*` functions implemented but failing
+**Fix**: Debug existing implementation
+
+**Implementation Steps**:
+1. Add debug output to `stdlib_t_map`, `stdlib_t_filter`, etc.
+2. Run test 17 with `DEBUG=4` to identify specific failure
+3. Fix parameter validation or table iteration logic
+4. Test with table enhancement operations
+
+#### **Task 2.2: Pattern Matching Memory** (Integration Test 02)
+**Issue**: Segmentation fault in complex patterns
+**Current**: Memory corruption in pattern matching
+**Fix**: Add memory debugging and fix recursion
+
+**Implementation Steps**:
+1. Add memory debugging to `interpreter_evaluate_when_expression`
+2. Check for infinite recursion in pattern matching
+3. Fix memory allocation/deallocation in pattern evaluation
+4. Test with complex pattern matching scenarios
+
+### **Phase 3: Validation**
+- Re-run comprehensive test suite
+- Target: 27/27 tests passing
+- Verify no regressions
+
+## Technical Notes
+
+### **Parser Architecture**
+- Table parsing: `parser_parse_primary` → `TOKEN_LBRACE` case
+- Pattern parsing: `parser_parse_when_pattern` → multi-parameter detection
+- Both need expression support in parentheses
+
+### **Standard Library**
+- `t.*` functions: Already implemented in `stdlib.c` (lines ~804-950)
+- Functions: `t.map`, `t.filter`, `t.reduce`, `t.set`, `t.delete`, `t.merge`, `t.length`, `t.has`
+- Issue: Likely parameter validation or table iteration
+
+### **Memory Management**
+- Pattern matching: Uses recursion for nested patterns
+- Potential: Stack overflow or memory corruption
+- Solution: Add bounds checking and memory debugging
+
+## Next Action
+**Proceed with Task 1.2** (Multi-value Pattern Expressions) - next high-impact parser extension.
\ No newline at end of file