use std::ops::{Index, IndexMut};
use std::vec::Vec;
+#[derive(Clone)]
pub struct Frame {
pub global_index: usize,
pub b0: usize,
}
impl Frame {
- fn new(global_index: usize, sz: usize, e: usize, cp: CodePtr, n: usize) -> Self {
+ fn new(global_index: usize, fr: usize, e: usize, cp: CodePtr, n: usize) -> Self {
Frame {
- global_index: global_index,
+ global_index,
b0: 0,
e: e,
cp: cp,
- perms: (1 .. n+1).map(|i| Addr::StackCell(sz, i)).collect()
+ perms: (1 .. n+1).map(|i| Addr::StackCell(fr, i)).collect()
}
}
}
pub fn clear(&mut self) {
self.0.clear()
}
+
+ pub fn pop(&mut self) {
+ self.0.pop();
+ }
}
impl Index<usize> for AndStack {
use std::fmt;
use std::io::Error as IOError;
use std::num::{ParseFloatError};
-use std::ops::{Add, AddAssign, Sub, Mul, Div, Neg};
+use std::ops::{Add, AddAssign, Sub, Mul, Neg};
use std::str::Utf8Error;
use std::vec::Vec;
match instr {
&ControlInstruction::Allocate(num_cells) => {
let num_frames = self.num_frames();
- self.and_stack.push(num_frames + 1, self.e, self.cp, num_cells);
+ self.and_stack.push(num_frames + 1, self.e, self.cp, num_cells);
self.e = self.and_stack.len() - 1;
+
self.p += 1;
},
&ControlInstruction::Call(ref name, arity, _) =>
self.cp = self.and_stack[e].cp;
self.e = self.and_stack[e].e;
-
+
self.p += 1;
},
&ControlInstruction::Execute(ref name, arity) =>