summaryrefslogtreecommitdiffstats
path: root/src/forth/interp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/forth/interp.rs')
-rw-r--r--src/forth/interp.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/forth/interp.rs b/src/forth/interp.rs
index cacc5e3..e41f0d9 100644
--- a/src/forth/interp.rs
+++ b/src/forth/interp.rs
@@ -29,6 +29,12 @@ pub enum OpCode {
#[derive(Clone, Debug)]
pub struct ByteCode(pub Vec<OpCode>);
+impl std::ops::Deref for ByteCode {
+ type Target = Vec<OpCode>;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
impl ByteCode {
pub fn len(&self) -> usize {
@@ -67,15 +73,20 @@ pub struct CallStack(pub Vec<InstructionPointer>);
#[derive(Clone, Debug)]
pub struct WordList(pub Vec<ByteCode>);
+impl std::ops::Deref for WordList {
+ type Target = Vec<ByteCode>;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
#[derive(Debug)]
pub struct Interp {
// todo: don't be pub, probably
pub stack: DataStack,
- callstack: CallStack,
- // todo: don't be pub
+ pub callstack: CallStack,
pub wordlist: WordList,
- ip: InstructionPointer,
+ pub ip: InstructionPointer,
}
#[derive(Debug)]