update README, heap ADT
This commit is contained in:
17
README.md
17
README.md
@@ -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
|
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.
|
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
|
## Built-in predicates
|
||||||
|
|
||||||
The following predicates are built-in to rusty-wam.
|
The following predicates are built-in to rusty-wam.
|
||||||
|
|||||||
@@ -968,19 +968,13 @@ impl Heap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn push(&mut self, val: HeapCellValue) {
|
pub fn push(&mut self, val: HeapCellValue) {
|
||||||
let h = self.h;
|
self.heap.push(val);
|
||||||
|
|
||||||
if h < self.heap.len() {
|
|
||||||
self.heap[h] = val;
|
|
||||||
} else {
|
|
||||||
self.heap.push(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.h += 1;
|
self.h += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn truncate(&mut self, h: usize) {
|
pub fn truncate(&mut self, h: usize) {
|
||||||
self.h = h;
|
self.h = h;
|
||||||
|
self.heap.truncate(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
@@ -988,9 +982,10 @@ impl Heap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn append(&mut self, vals: Vec<HeapCellValue>) {
|
pub fn append(&mut self, vals: Vec<HeapCellValue>) {
|
||||||
for val in vals.into_iter() {
|
let n = vals.len();
|
||||||
self.push(val);
|
|
||||||
}
|
self.heap.extend(vals.into_iter());
|
||||||
|
self.h += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user