add batch processing.
This commit is contained in:
@@ -82,8 +82,10 @@ The following predicates are built-in to rusty-wam.
|
|||||||
* `(=..)/2`
|
* `(=..)/2`
|
||||||
* `(->)/2`
|
* `(->)/2`
|
||||||
* `(;)/2`
|
* `(;)/2`
|
||||||
|
* `append/3`
|
||||||
* `arg/3`
|
* `arg/3`
|
||||||
* `atomic/1`
|
* `atomic/1`
|
||||||
|
* `between/3`
|
||||||
* `call/1..63`
|
* `call/1..63`
|
||||||
* `catch/3`
|
* `catch/3`
|
||||||
* `display/1`
|
* `display/1`
|
||||||
@@ -92,6 +94,12 @@ The following predicates are built-in to rusty-wam.
|
|||||||
* `functor/3`
|
* `functor/3`
|
||||||
* `integer/1`
|
* `integer/1`
|
||||||
* `length/2`
|
* `length/2`
|
||||||
|
* `maplist/1..8`
|
||||||
|
* `member/2`
|
||||||
|
* `memberchk/2`
|
||||||
|
* `once/1`
|
||||||
|
* `reverse/2`
|
||||||
|
* `select/3`
|
||||||
* `throw/1`
|
* `throw/1`
|
||||||
* `true/0`
|
* `true/0`
|
||||||
* `var/1`
|
* `var/1`
|
||||||
|
|||||||
15
src/main.rs
15
src/main.rs
@@ -5,12 +5,9 @@ mod prolog;
|
|||||||
#[macro_use] mod test_utils;
|
#[macro_use] mod test_utils;
|
||||||
|
|
||||||
use prolog::io::*;
|
use prolog::io::*;
|
||||||
|
use prolog::lib::lists::*;
|
||||||
use prolog::machine::*;
|
use prolog::machine::*;
|
||||||
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::prelude::*;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
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() {
|
fn prolog_repl() {
|
||||||
let mut wam = Machine::new();
|
let mut wam = Machine::new();
|
||||||
|
|
||||||
|
load_init_str(&mut wam, LISTS);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
print!("prolog> ");
|
print!("prolog> ");
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ pub mod heap_print;
|
|||||||
pub mod indexing;
|
pub mod indexing;
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod iterators;
|
pub mod iterators;
|
||||||
|
pub mod lib;
|
||||||
pub mod machine;
|
pub mod machine;
|
||||||
pub mod or_stack;
|
pub mod or_stack;
|
||||||
pub mod parser;
|
pub mod parser;
|
||||||
|
|||||||
Submodule src/prolog/parser updated: 64866ff3ef...2579afe5fd
Reference in New Issue
Block a user