feat: add C code generation backend and build command to CLI

Add C backend to nxc-frontend:
- Implement CEmitter with HIR-to-C translation
- Add emit_c() function for code generation
- Support function prototypes, statements, expressions, and control flow
- Generate C11-compatible code with proper type mapping
- Add main() wrapper generation for entry points

Extend driver crate with build pipeline:
- Add emit_c_from_frontend() to generate C source from HIR
- Add write_c_file() to write generated
This commit is contained in:
2026-04-06 17:24:01 +02:00
parent 9304b6bcaa
commit 1e30c05233
9 changed files with 1032 additions and 17 deletions

View File

@@ -1,18 +1,6 @@
struct AppConfig:
port: Int
service_name: String
fn build_message(name: String, port: Int) -> String:
if port > 0 && port < 65536:
return name
else:
return "invalid"
fn main() -> Int:
let config = build_message("backend-api", 8080)
let enabled = true || false
if enabled:
return 0
else:
return 1