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

@@ -82,8 +82,10 @@ The following predicates are built-in to rusty-wam.
* `(=..)/2`
* `(->)/2`
* `(;)/2`
* `append/3`
* `arg/3`
* `atomic/1`
* `between/3`
* `call/1..63`
* `catch/3`
* `display/1`
@@ -92,6 +94,12 @@ The following predicates are built-in to rusty-wam.
* `functor/3`
* `integer/1`
* `length/2`
* `maplist/1..8`
* `member/2`
* `memberchk/2`
* `once/1`
* `reverse/2`
* `select/3`
* `throw/1`
* `true/0`
* `var/1`

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> ");

View File

@@ -18,6 +18,7 @@ pub mod heap_print;
pub mod indexing;
pub mod io;
pub mod iterators;
pub mod lib;
pub mod machine;
pub mod or_stack;
pub mod parser;