- updated common with new compiler/builder trait to provide a common
interface for build tools - updated editor and build tooling to use new system
This commit is contained in:
+16
-2
@@ -1,4 +1,7 @@
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use common::{build::Builder, logging::log};
|
||||
use compiler::Compiler;
|
||||
|
||||
fn main() {
|
||||
// read from input file: syntax "c_compiler <src.c> [output.dsa]"
|
||||
@@ -15,5 +18,16 @@ fn main() {
|
||||
"output.dsa"
|
||||
};
|
||||
|
||||
compiler::compile_file(Path::new(input_file), Path::new(output_file)).unwrap();
|
||||
{
|
||||
let mut builder = Compiler::new(PathBuf::from(input_file));
|
||||
builder.start();
|
||||
let result = builder.output().unwrap();
|
||||
|
||||
std::fs::write(output_file, &result).expect("Failed to write output");
|
||||
|
||||
log(&format!(
|
||||
"Compilation Successful ✅ \n\tSource: {}\n\tOutput: {}\n",
|
||||
input_file, output_file,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user