17 lines
389 B
Rust
17 lines
389 B
Rust
use std::{io::{Read, stdin}, process::exit};
|
|
|
|
use brainrust::*;
|
|
|
|
fn main() {
|
|
let mut str = String::new();
|
|
stdin().read_to_string(&mut str).unwrap();
|
|
|
|
let eval_res = eval(&str.as_str());
|
|
if eval_res.is_err() {
|
|
let err = eval_res.unwrap_err();
|
|
if err == "Stdin closed" {
|
|
exit(0);
|
|
}
|
|
eprintln!("Program failed: {}", err);
|
|
}
|
|
} |