2023-06-20 19:07:48 -05:00
|
|
|
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![];
|
2023-07-10 16:18:23 -05:00
|
|
|
if let Err(e) = hbasm::text::assembly(&code, &mut buf) {
|
2023-06-20 19:07:48 -05:00
|
|
|
eprintln!(
|
|
|
|
"Error {:?} at {:?} (`{}`)",
|
|
|
|
e.kind,
|
|
|
|
e.span.clone(),
|
|
|
|
&code[e.span],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
stdout().write_all(&buf)?;
|
|
|
|
Ok(())
|
|
|
|
}
|