update README, heap ADT

This commit is contained in:
Mark Thom
2017-12-10 13:55:49 -07:00
parent 9d944e2268
commit 2dc7832f59
2 changed files with 23 additions and 11 deletions

View File

@@ -42,6 +42,23 @@ IR to get JIT-compiled and -executed Prolog programs.
It's my hope to use rusty-wam as the logic engine of a low level (and
ideally, very fast) [Shen](http://shenlanguage.org) implementation.
## Nice to have features
There are no current plans to implement any of these, but they might be
nice to have in the future. They'd make a good project for anyone wanting
to contribute code to rusty-wam.
1. Add the global analysis techniques of Peter van Roy's thesis, "Can
Logic Programming Execute as Fast as Imperative Programming?"
2. Add support for unum representation and arithmetic, as described in Gustafson's
book "The End of Error."
3. Add support for shift/reset delimited continuations, see "Delimited Continuations
for Prolog."
4. Add an incremental compacting garbage collector the heap.
## Built-in predicates
The following predicates are built-in to rusty-wam.

View File

@@ -968,19 +968,13 @@ impl Heap {
}
pub fn push(&mut self, val: HeapCellValue) {
let h = self.h;
if h < self.heap.len() {
self.heap[h] = val;
} else {
self.heap.push(val);
}
self.heap.push(val);
self.h += 1;
}
pub fn truncate(&mut self, h: usize) {
self.h = h;
self.heap.truncate(h);
}
pub fn len(&self) -> usize {
@@ -988,9 +982,10 @@ impl Heap {
}
pub fn append(&mut self, vals: Vec<HeapCellValue>) {
for val in vals.into_iter() {
self.push(val);
}
let n = vals.len();
self.heap.extend(vals.into_iter());
self.h += n;
}
pub fn clear(&mut self) {