Define what "outer interpreter" means

This commit is contained in:
Peter Fidelman 2022-05-22 10:51:04 -07:00
parent 7fd742f0b1
commit 541eddad68

View file

@ -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