forked from AbleOS/holey-bytes
Erin
06b1184772
- Changed instruction encoding to be faster to match on - Implemented all instructions defined in spec - Bytecode validation - Assembler - Implemented 5 level paging (based on SV57) - Implemented some degree of interrupts (though not fully adhering the spec yet)
22 lines
465 B
Rust
22 lines
465 B
Rust
use std::{
|
|
error::Error,
|
|
io::{stdin, stdout, Read, Write},
|
|
};
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
let mut code = String::new();
|
|
stdin().read_to_string(&mut code)?;
|
|
|
|
let mut buf = vec![];
|
|
if let Err(e) = hbasm::assembly(&code, &mut buf) {
|
|
eprintln!(
|
|
"Error {:?} at {:?} (`{}`)",
|
|
e.kind,
|
|
e.span.clone(),
|
|
&code[e.span],
|
|
);
|
|
}
|
|
stdout().write_all(&buf)?;
|
|
Ok(())
|
|
}
|