1
2use crate::{human::*, theory::*};
3
4use alloc::string::String;
5use core::{fmt::Write, str};
6
7pub fn runner(out: &mut String, input: &str) {
9 let mut dict = Dict::new();
10
11 let inp = match parse(input, &mut dict) {
12 Ok(k) => k,
13 Err(e) => {
14 let _ = write!(out, "P[!]: parse error at byte {}: {}\n", e.byte, e.msg);
15 return;
16 }
17 };
18
19 let mut exp = lore(Kind::from((inp, lore_end())));
20 let _ = write!(out, "I: {}\n", unparse(&exp, &dict));
21
22 match eta(&mut exp) {
23 Ok(res) => { let _ = write!(out, "E[^]: {}\n", &unparse(&res, &dict)); }
24 Err(res) => { let _ = write!(out, "E[H]: {}\n", &unparse(&res, &dict)); }
25 }
26}