feat: replace Cranelift JIT with C backend
Remove Cranelift JIT compiler and expose the existing C backend as the compilation target. Generated C code can be compiled with GCC/Clang. Changes: - Remove cranelift-* dependencies from Cargo.toml - Delete src/compiler.rs (565 lines of Cranelift code) - Add compile_to_c() function with -o and --run flags - Fix C backend name mangling (main -> main_lux) to avoid conflicts - Update CLI help text and documentation Usage: lux compile <file.lux> # Output C to stdout lux compile <file.lux> -o out.c # Write to file lux compile <file.lux> --run # Compile and execute C backend supports: functions, basic types, operators, if/then/else, records, enums, Console.print. Future work: closures, lists, patterns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,10 +67,10 @@
|
||||
| Task | Priority | Effort | Status |
|
||||
|------|----------|--------|--------|
|
||||
| Elm-quality error messages | P1 | 2 weeks | ⚠️ Partial (context shown, suggestions missing) |
|
||||
| Full JS compilation | P2 | 4 weeks | ⚠️ JIT for numeric code only |
|
||||
| Full JS compilation | P2 | 4 weeks | ❌ Missing |
|
||||
| Hot reload / watch mode | P2 | — | ✅ Complete |
|
||||
| Debugger improvements | P3 | 2 weeks | ✅ Basic |
|
||||
| JIT CLI integration | P1 | — | ✅ Complete (`lux compile`) |
|
||||
| C backend CLI integration | P1 | — | ✅ Complete (`lux compile`) |
|
||||
|
||||
### Success Criteria for Use Case 1
|
||||
- [ ] Can build a REST API with database access
|
||||
@@ -220,7 +220,8 @@
|
||||
|
||||
| Task | Priority | Effort | Status |
|
||||
|------|----------|--------|--------|
|
||||
| Extend JIT (strings, lists) | P1 | 2 weeks | ❌ Missing |
|
||||
| C backend (basic) | P1 | — | ✅ Complete (functions, Console.print) |
|
||||
| Extend C backend (closures, lists) | P1 | 2 weeks | ❌ Missing |
|
||||
| JS backend | P2 | 4 weeks | ❌ Missing |
|
||||
| WASM backend | P3 | 4 weeks | ❌ Missing |
|
||||
|
||||
@@ -296,7 +297,7 @@
|
||||
- ✅ JSON parsing/serialization (parse, stringify, get, object, array)
|
||||
|
||||
**Tooling:**
|
||||
- ✅ JIT compiler (~160x speedup, CLI: `lux compile`)
|
||||
- ✅ C backend (functions, Console.print, CLI: `lux compile`)
|
||||
- ✅ REPL with history
|
||||
- ✅ Basic LSP server
|
||||
- ✅ Formatter
|
||||
|
||||
Reference in New Issue
Block a user