parsing seems to be working fine
This commit is contained in:
32
src/main.rs
Normal file
32
src/main.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use std::fs;
|
||||
use std::env;
|
||||
|
||||
|
||||
#[macro_use]
|
||||
extern crate pest_derive;
|
||||
|
||||
use pest::Parser;
|
||||
|
||||
|
||||
mod asm;
|
||||
mod parse;
|
||||
mod generate;
|
||||
|
||||
use parse::{parse_asm, AsmParser};
|
||||
|
||||
fn main() {
|
||||
let file_name = env::args().nth(1);
|
||||
|
||||
let file_content = match file_name {
|
||||
Some(file_name) => {
|
||||
fs::read_to_string(file_name).expect("Could not read the provided asm file")
|
||||
}
|
||||
None => {
|
||||
println!("No input file was provided");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let instructions = parse_asm(AsmParser::parse(parse::Rule::program, &file_content).unwrap_or_else(|e| panic!("{}", e)));
|
||||
println!("{:#?}", instructions);
|
||||
}
|
||||
Reference in New Issue
Block a user