add catch/throw support, make exceptions and arithmetic tests pass.

This commit is contained in:
Mark Thom
2018-05-10 01:43:36 -06:00
parent bae107f8cd
commit 954c29b103
9 changed files with 314 additions and 155 deletions

View File

@@ -601,6 +601,22 @@ pub fn compile_packet(wam: &mut Machine, tl: TopLevelPacket) -> EvalSession
}
}
pub static BUILTINS: &str = include_str!("./lib/builtins.pl");
pub fn load_init_str(wam: &mut Machine, src_str: &str)
{
match compile_listing(wam, src_str) {
EvalSession::Error(_) => panic!("failed to parse batch from string."),
_ => {}
}
}
pub fn load_init_str_and_include(wam: &mut Machine, src_str: &str, module: &'static str)
{
load_init_str(wam, src_str);
wam.use_module_in_toplevel(clause_name!(module));
}
pub fn compile_listing(wam: &mut Machine, src_str: &str) -> EvalSession
{
fn get_module_name(module: &Option<Module>) -> ClauseName {