Skip to content
Snippets Groups Projects

Run juno bin on ir files

Merged rarbore2 requested to merge paper_stuff into main
9 files
+ 26
738
Compare changes
  • Side-by-side
  • Inline
Files
9
+ 26
6
use juno_compiler::*;
use std::fs::read_to_string;
 
use std::path::PathBuf;
use clap::Parser;
use clap::Parser;
use std::path::PathBuf;
use juno_compiler::*;
#[derive(Parser)]
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
#[clap(author, version, about, long_about = None)]
@@ -12,6 +13,8 @@ struct Cli {
@@ -12,6 +13,8 @@ struct Cli {
schedule: Option<String>,
schedule: Option<String>,
#[arg(short, long = "output-dir", value_name = "OUTPUT DIR")]
#[arg(short, long = "output-dir", value_name = "OUTPUT DIR")]
output_dir: Option<String>,
output_dir: Option<String>,
 
#[arg(short, long, value_name = "TREAT AS HERCULES IR")]
 
ir: bool,
}
}
fn main() {
fn main() {
@@ -25,10 +28,27 @@ fn main() {
@@ -25,10 +28,27 @@ fn main() {
.unwrap()
.unwrap()
.to_string(),
.to_string(),
};
};
match compile(args.src_file, args.schedule, output_dir) {
if args.ir {
Ok(()) => {}
let Ok(contents) = read_to_string(&args.src_file) else {
Err(errs) => {
panic!("Unable to open and read input file.");
eprintln!("{}", errs);
};
 
let Ok(ir_mod) = hercules_ir::parse::parse(&contents) else {
 
panic!("Unable to parse Hercules IR file.");
 
};
 
 
let module_name = "module".to_string();
 
match compile_ir(ir_mod, args.schedule, output_dir, module_name) {
 
Ok(()) => {}
 
Err(errs) => {
 
eprintln!("{}", errs);
 
}
 
}
 
} else {
 
match compile(args.src_file, args.schedule, output_dir) {
 
Ok(()) => {}
 
Err(errs) => {
 
eprintln!("{}", errs);
 
}
}
}
}
}
}
}
Loading