eta_core/
basic.rs

1
2use crate::{human::*, theory::*};
3
4use alloc::string::String;
5use core::{fmt::Write, str};
6
7/* the thing that does */
8pub 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, "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, "inp: {}\n", unparse(&inp, &dict));
21    let _ = write!(out, "exp: {}\n", unparse(&exp, &dict));
22
23    match eta(&mut exp) {
24        Ok(res) => { let _ = write!(out, "[^] {}\n", unparse(&res, &dict)); }
25        Err(res) => { let _ = write!(out, "[H] {}\n", unparse(&res, &dict)); }
26    }
27}