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
10 lines
159 B
Plaintext
10 lines
159 B
Plaintext
fn add(a: Int, b: Int) -> Int:
|
|
return a + b
|
|
|
|
fn main() -> Int:
|
|
let value = add(20, 22)
|
|
if value == 42:
|
|
return 0
|
|
else:
|
|
return 1
|