feat: add list support to C backend and improve compile workflow

C Backend Lists:
- Add LuxList type (dynamic array with void* boxing)
- Implement all 16 list operations: length, isEmpty, concat, reverse,
  range, take, drop, head, tail, get, map, filter, fold, find, any, all
- Higher-order operations generate inline loops with closure calls
- Fix unique variable names to prevent redefinition errors

Compile Command:
- `lux compile file.lux` now produces a binary (like rustc, go build)
- Add `--emit-c` flag to output C code instead
- Binary name derived from source filename (foo.lux -> ./foo)
- Clean up temp files after compilation

Documentation:
- Create docs/C_BACKEND.md with full strategy documentation
- Document compilation pipeline, runtime types, limitations
- Compare with Koka, Rust, Zig, Go, Nim, OCaml approaches
- Outline future roadmap (evidence passing, Perceus RC)
- Fix misleading doc comment (remove false Perceus claim)
- Update OVERVIEW.md and ROADMAP.md to reflect list completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 11:02:26 -05:00
parent d284ee58a8
commit 909dbf7a97
5 changed files with 954 additions and 87 deletions

View File

@@ -223,7 +223,7 @@
| C backend (basic) | P1 | — | ✅ Complete (functions, Console.print) |
| Extend C backend (closures) | P1 | — | ✅ Complete |
| Extend C backend (pattern matching) | P1 | — | ✅ Complete |
| Extend C backend (lists) | P1 | 1 week | ❌ Missing |
| Extend C backend (lists) | P1 | — | ✅ Complete |
| JS backend | P2 | 4 weeks | ❌ Missing |
| WASM backend | P3 | 4 weeks | ❌ Missing |