add batch processing.
This commit is contained in:
15
src/main.rs
15
src/main.rs
@@ -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> ");
|
||||
|
||||
Reference in New Issue
Block a user