From 541eddad6872f434d5f73359c827285826f0258f Mon Sep 17 00:00:00 2001 From: Peter Fidelman Date: Sun, 22 May 2022 10:51:04 -0700 Subject: [PATCH] Define what "outer interpreter" means --- frustration.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frustration.rs b/frustration.rs index fecdc75..99a9ddb 100644 --- a/frustration.rs +++ b/frustration.rs @@ -2069,6 +2069,16 @@ fn build_dictionary(c: &mut Core) { * Forth names this "quit", for the reason that calling "quit" in * the middle of a compiled program is a reasonable way to bring * you back to top-level. + * + * "quit" is called the "outer interpreter" because it is the outermost + * interpreter loop that Forth uses. Some Forth implementations also + * use an "inner interpreter" to execute their threaded code. Our Forth + * does not have an inner interpreter because we used subroutine + * threading, making our threaded code a list of subroutine calls that + * can be directly executed by the CPU. + * + * Let's look at what "quit" does. We've already done all the hard work + * so it can be quite short. */ // quit ( -- ) @@ -2076,7 +2086,9 @@ fn build_dictionary(c: &mut Core) { forth!( quote, /* Read a word from the keyboard and look it up in * the dictionary */ + dispatch, /* Figure out what to do with the word */ + quit /* Repeat forever */ /* You might have noticed that "quit" isn't tail-recursive -- it