mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
51 lines
1.1 KiB
Rust
51 lines
1.1 KiB
Rust
#[macro_use]
|
|
extern crate clap;
|
|
use clap::{crate_authors, crate_description, crate_version, App};
|
|
|
|
#[macro_use]
|
|
extern crate kecc;
|
|
|
|
use kecc::{Parse, Translate};
|
|
use std::path::Path;
|
|
|
|
fn main() {
|
|
let yaml = load_yaml!("fuzz_cli.yml");
|
|
#[allow(deprecated)]
|
|
let matches = App::from_yaml(yaml)
|
|
.version(crate_version!())
|
|
.about(crate_description!())
|
|
.author(crate_authors!(", "))
|
|
.get_matches();
|
|
|
|
let input = matches.value_of("INPUT").unwrap();
|
|
let unit = ok_or_exit!(Parse::default().translate(&input), 1);
|
|
|
|
if matches.is_present("print") {
|
|
kecc::test_write_c(&unit, Path::new(&input));
|
|
return;
|
|
}
|
|
|
|
if matches.is_present("irgen") {
|
|
kecc::test_irgen(&unit, Path::new(&input));
|
|
return;
|
|
}
|
|
|
|
if matches.is_present("simplify-cfg") {
|
|
todo!("test simplify-cfg");
|
|
}
|
|
|
|
if matches.is_present("mem2erg") {
|
|
todo!("test mem2reg");
|
|
}
|
|
|
|
if matches.is_present("deadcode") {
|
|
todo!("test deadcode");
|
|
}
|
|
|
|
if matches.is_present("gvn") {
|
|
todo!("test gvn");
|
|
}
|
|
|
|
kecc::test_asmgen(&unit, Path::new(&input));
|
|
}
|