From 2eecdb1a4bae0fbced05f4c375cd6126929fb1fb Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 7 Aug 2025 14:16:43 -0400 Subject: parser now emits list of words and hashmap of string→index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wordlist is just a vector of bytecode entries. to associate a word to an entry in the wordlist, use the word catalog to look up by name. --- src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/lib.rs (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..da1469b --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,24 @@ +use wasm_bindgen::prelude::*; + +mod forth; + +#[wasm_bindgen] +extern { + #[wasm_bindgen(js_namespace = console)] + fn debug(s: &str); +} + +#[wasm_bindgen(start)] +pub fn run() -> Result<(), JsValue> { + let window = web_sys::window().expect("no global `window` exists"); + let document = window.document().expect("should have `document` on window"); + let body = document.body().expect("document should have `body`"); + + let val = document.create_element("p")?; + val.set_text_content(Some("hi there")); + body.append_child(&val)?; + + debug("done in rust's run"); + + Ok(()) +} -- cgit v1.3