futilehdl/src/main.rs

26 lines
663 B
Rust
Raw Normal View History

2021-12-30 19:46:28 +00:00
mod literals;
2022-01-01 21:43:38 +00:00
mod parser;
mod rtlil;
2021-12-30 19:46:28 +00:00
2022-01-01 21:43:38 +00:00
use nom::error::{convert_error, VerboseError};
2022-01-04 00:38:35 +00:00
use structopt::StructOpt;
2021-12-30 19:46:28 +00:00
// custom IResult type for verboseerror
pub type IResult<I, O, E = VerboseError<I>> = nom::IResult<I, O, E>;
fn main() {
let input = include_str!("../identity.fut");
2022-01-01 21:43:38 +00:00
let parsed = parser::module(input);
2021-12-30 19:46:28 +00:00
match parsed {
Err(nom::Err::Error(err) | nom::Err::Failure(err)) => {
print!("{}", convert_error(input, err))
}
Err(_) => (),
2022-01-01 21:43:38 +00:00
Ok(res) => {
println!("{:#?}", res);
let lowered = crate::rtlil::lower_module(res.1);
println!("{}", lowered);
}
2021-12-30 19:46:28 +00:00
}
}