summaryrefslogtreecommitdiffstats
path: root/src/forth
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-08-22 13:38:47 -0400
committerBrian Cully <bjc@spork.org>2025-08-22 14:42:36 -0400
commit79441128958669b16ce8dfe39a3684069921f604 (patch)
tree4112092916e7bf568cc67e6bcd0621779e2d6eae /src/forth
parent4f7bbbf4ee269ef6638c69fc5982b0dfe4b8b947 (diff)
downloadautomathon-79441128958669b16ce8dfe39a3684069921f604.tar.gz
automathon-79441128958669b16ce8dfe39a3684069921f604.zip
make compile button actually compile
Diffstat (limited to 'src/forth')
-rw-r--r--src/forth/interp.rs6
-rwxr-xr-xsrc/forth/mod.rs4
-rw-r--r--src/forth/parser.rs5
3 files changed, 9 insertions, 6 deletions
diff --git a/src/forth/interp.rs b/src/forth/interp.rs
index c6dcb72..b34ed31 100644
--- a/src/forth/interp.rs
+++ b/src/forth/interp.rs
@@ -66,15 +66,15 @@ pub(super) struct DataStack(pub(super) Vec<i32>);
pub(super) struct CallStack(pub(super) Vec<InstructionPointer>);
#[derive(Clone, Debug)]
-pub(super) struct WordList(pub(super) Vec<ByteCode>);
+pub struct WordList(pub(super) Vec<ByteCode>);
#[derive(Debug)]
pub struct Interp {
// todo: don't be pub, probably
- pub stack: DataStack,
+ pub(super) stack: DataStack,
callstack: CallStack,
// todo: don't be pub
- pub wordlist: WordList,
+ pub(super) wordlist: WordList,
ip: InstructionPointer,
}
diff --git a/src/forth/mod.rs b/src/forth/mod.rs
index 5792148..063b40e 100755
--- a/src/forth/mod.rs
+++ b/src/forth/mod.rs
@@ -1,5 +1,5 @@
-mod interp;
-mod parser;
+pub mod interp;
+pub mod parser;
#[cfg(test)]
mod tests {
diff --git a/src/forth/parser.rs b/src/forth/parser.rs
index 55ad64b..ac6715d 100644
--- a/src/forth/parser.rs
+++ b/src/forth/parser.rs
@@ -1,5 +1,7 @@
use super::interp::{ByteCode, OpCode, WordList};
+use log::debug;
+
use std::collections::HashMap;
use std::iter::{Enumerate, Iterator};
use std::str::Chars;
@@ -45,7 +47,7 @@ pub struct Parser<'a> {
// todo: don't be pub, have a method to extract a wordlist
pub wordlist: WordList,
// catalog of word to word index in `wordlist`
- wordalog: WordCatalog<'a>,
+ pub wordalog: WordCatalog<'a>,
// holds a stack of indices into `wordlist` that are currently
// being defined, with the top of stack being the most recent
// definition.
@@ -79,6 +81,7 @@ impl<'a> Parser<'a> {
self.enumerator.by_ref()
.find(|(_i, c)| c.is_whitespace())?;
let word = &self.text[start..end];
+ debug!("Parser::next_word → ‘{}’ ({} → {})", word, start, end);
Some((word, start, end))
}