use shm_rs::error::SchemeResult; use shm_rs::lexer::lexer; use shm_rs::static_scheme::init; use shm_rs::dynamic_scheme::environment; fn main() { match main1() { Ok(_) => {}, Err(e) => { println!("{}", e); return; } } } fn main1() -> SchemeResult<()> { let mut curdir = std::env::current_dir().unwrap(); curdir.push("examples/test1.shm"); println!("{}", curdir.display()); let lex = lexer::Lexer::from_file(curdir)?; let schm = init::SchemeInit::new()?; let res = schm.run(&lex, None)?; let resser = res.get("test1").unwrap().clone(); println!("Static: \n{:?}\n", res); let mut curdir = std::env::current_dir().unwrap(); curdir.push("examples/test2.shm"); let lex = lexer::Lexer::from_file(curdir)?; let dynenv = environment::DynEnvironment::new_root(resser).unwrap(); let dynres = environment::DynEnvironment::run(&lex, dynenv)?; println!("Dynamic: \n{:?}\n", dynres); return Ok(()); }