Table of contents

This commit is contained in:
Peter Fidelman 2022-05-22 10:45:53 -07:00
parent 5b79671b2c
commit 7fd742f0b1

View file

@ -46,9 +46,20 @@ use std::convert::TryInto;
* But before we can do any of that we will need a machine. Let's make one. * But before we can do any of that we will need a machine. Let's make one.
*/ */
/* Table of Contents
* Part 1 - The Computer
* Part 1a - The instruction set
* Part 2 - The Program
* Part 2a - The lexer
* Part 2b - The outer interpreter
* Part 3 - Using the interactive programming environment
*/
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* Part 1 - The Computer * Part 1 - The Computer
* ------------------------------------------------------------------------ */ * ------------------------------------------------------------------------- */
/* This computer will have a 16-bit CPU. It will be able to access /* This computer will have a 16-bit CPU. It will be able to access
* 2^16 (65536) memory locations, numbered 0 to 65535. * 2^16 (65536) memory locations, numbered 0 to 65535.
@ -187,6 +198,10 @@ fn new_core() -> Core {
return c; return c;
} }
/* ---------------------------------------------------------------------------
* Part 1a - The instruction set
* ------------------------------------------------------------------------- */
/* Now we have a CPU sitting there but it does nothing. /* Now we have a CPU sitting there but it does nothing.
* *
* A working CPU would execute a list of instructions. An instruction is * A working CPU would execute a list of instructions. An instruction is
@ -640,7 +655,7 @@ const PRIMITIVES: [Primitive; 16] = [
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* Part 2 - The Program * Part 2 - The Program
* ------------------------------------------------------------------------ */ * ------------------------------------------------------------------------- */
/* You now have an unfamiliar computer with no software. Can you and the /* You now have an unfamiliar computer with no software. Can you and the
* computer write a program? * computer write a program?
@ -1205,7 +1220,7 @@ fn build_dictionary(c: &mut Core) {
*/ */
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Part 2a. The lexer * Part 2a - The lexer
*---------------------------------------------------------------------- */ *---------------------------------------------------------------------- */
/* Now that we've got some basics in place let's go back to solving /* Now that we've got some basics in place let's go back to solving
@ -1767,7 +1782,7 @@ fn build_dictionary(c: &mut Core) {
forth!(word, find, RET); forth!(word, find, RET);
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Part 2b. The outer interpreter * Part 2b - The outer interpreter
*---------------------------------------------------------------------- */ *---------------------------------------------------------------------- */
/* We can now look up a subroutine in the dictionary by typing its name /* We can now look up a subroutine in the dictionary by typing its name
@ -2192,6 +2207,10 @@ fn main() {
} }
} }
/* ---------------------------------------------------------------------------
* Part 3 - Using the interactive programming environment
* ------------------------------------------------------------------------- */
/* "The next step is a problem-oriented-language. By permitting /* "The next step is a problem-oriented-language. By permitting
* the program to dynamically modify its control language, we * the program to dynamically modify its control language, we
* mark a qualitative change in capability. We also change our * mark a qualitative change in capability. We also change our