From a964c869670599ab856a47ccf02aa4006ea9951c Mon Sep 17 00:00:00 2001 From: uan Date: Wed, 4 Feb 2026 22:35:45 +0100 Subject: [PATCH] - --- generator.v | 5 ----- 1 file changed, 5 deletions(-) diff --git a/generator.v b/generator.v index 35b13ff..e50d8d6 100644 --- a/generator.v +++ b/generator.v @@ -134,20 +134,16 @@ fn (mut g Generator) gen_c(program []Stmt) string { } fn compile_with_clang(c_code string, output_name string, keep_c bool) { - // 1. Write the C code to a temporary file c_file := 'middle_c.c' os.write_file(c_file, c_code) or { eprintln('Failed to write C file: $err') return } - // 2. Construct the clang command - // We'll use -O2 for optimization and -o to specify the output binary clang_cmd := 'clang ${c_file} -o ${output_name} -O2' println('Executing: ${clang_cmd}') - // 3. Run the command result := os.execute(clang_cmd) if result.exit_code != 0 { @@ -155,7 +151,6 @@ fn compile_with_clang(c_code string, output_name string, keep_c bool) { eprintln(result.output) } else { println('Compilation successful! Binary created: $output_name') - // Optional: Remove the temporary C file if !keep_c { os.rm(c_file) or { } }