support call/N
This commit is contained in:
@@ -98,6 +98,10 @@ impl fmt::Display for ControlInstruction {
|
||||
write!(f, "allocate {}", num_cells),
|
||||
&ControlInstruction::Call(ref name, arity, pvs) =>
|
||||
write!(f, "call {}/{}, {}", name, arity, pvs),
|
||||
&ControlInstruction::CallN(arity) =>
|
||||
write!(f, "call_N {}", arity),
|
||||
&ControlInstruction::ExecuteN(arity) =>
|
||||
write!(f, "execute_N {}", arity),
|
||||
&ControlInstruction::Deallocate =>
|
||||
write!(f, "deallocate"),
|
||||
&ControlInstruction::Execute(ref name, arity) =>
|
||||
@@ -265,6 +269,7 @@ pub fn eval<'a, 'b: 'a>(wam: &'a mut Machine, tl: &'b TopLevel) -> EvalSession<'
|
||||
|
||||
if is_consistent(clauses) {
|
||||
let compiled_pred = cg.compile_predicate(clauses);
|
||||
print_code(&compiled_pred);
|
||||
wam.add_predicate(clauses, compiled_pred);
|
||||
|
||||
EvalSession::EntrySuccess
|
||||
@@ -280,6 +285,7 @@ Each predicate must have the same name and arity.";
|
||||
let mut cg = CodeGenerator::<DebrayAllocator>::new();
|
||||
|
||||
let compiled_fact = cg.compile_fact(fact);
|
||||
print_code(&compiled_fact);
|
||||
wam.add_fact(fact, compiled_fact);
|
||||
|
||||
EvalSession::EntrySuccess
|
||||
@@ -288,6 +294,7 @@ Each predicate must have the same name and arity.";
|
||||
let mut cg = CodeGenerator::<DebrayAllocator>::new();
|
||||
|
||||
let compiled_rule = cg.compile_rule(rule);
|
||||
print_code(&compiled_rule);
|
||||
wam.add_rule(rule, compiled_rule);
|
||||
|
||||
EvalSession::EntrySuccess
|
||||
@@ -296,7 +303,8 @@ Each predicate must have the same name and arity.";
|
||||
let mut cg = CodeGenerator::<DebrayAllocator>::new();
|
||||
|
||||
let compiled_query = cg.compile_query(query);
|
||||
wam.submit_query(compiled_query, cg.take_vars())
|
||||
print_code(&compiled_query);
|
||||
wam.submit_query(compiled_query, cg.take_vars())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user