add batch processing.

This commit is contained in:
Mark Thom
2018-01-30 00:59:42 -07:00
parent 9ce6403244
commit 2628e27595
4 changed files with 21 additions and 5 deletions

View File

@@ -5,12 +5,9 @@ mod prolog;
#[macro_use] mod test_utils;
use prolog::io::*;
use prolog::lib::lists::*;
use prolog::machine::*;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
#[cfg(test)]
mod tests;
@@ -25,8 +22,18 @@ fn process_buffer(wam: &mut Machine, buffer: &str)
};
}
fn load_init_str(wam: &mut Machine, src_str: &str)
{
match parse_batch(wam, src_str) {
Ok(tls) => compile_batch(wam, &tls),
Err(_) => panic!("failed to parse batch from string.")
};
}
fn prolog_repl() {
let mut wam = Machine::new();
load_init_str(&mut wam, LISTS);
loop {
print!("prolog> ");