Commit 75b303d2 authored by paysan's avatar paysan

PhiHo Hoang's take on the appendices

parent e4ce6922
......@@ -20,7 +20,7 @@ mass storage then ``\forthb{LOAD}''ed.
\index{D!Defining words:!procedure|(}
All words, whether included with the system or user-defined, exist in the
``dictionary,'' a linked list. A ``defining word,'' is used to add new
``dictionary,'' a linked list. A ``defining word'' is used to add new
names to the dictionary. One defining word is \forthb{:} (pronounced
``colon''), which is used to define a new word in terms of previously
defined words. Here is how one might define a new word called \forth{LIFT}:
......@@ -83,7 +83,7 @@ increments the count by two, making it 102.
\Forth{} provides many other
data structure operators\index{D!Data structures:!operators}, but more
importantly, it provides the tools necessary for the programmer to
create any time of data structure needed for the application.%
create any type of data structure needed for the application.%
\index{D!Dictionary:!defined|)}%
\section{The Stack}
......@@ -123,7 +123,7 @@ continues.
\section{Control Structures}
\Forth{} provides all the control structures%
\index{C!Control structures:!defined}%
\index{C!Control structures:!defined}
needed for structured, GOTO-less programming.
The syntax of the \forthb{IF THEN} construct is as follows:
......
......@@ -72,9 +72,9 @@ COMPILE (MAKE) HERE MARKER ! 0 ,
\end{Code}
We can see how \forthb{MAKE} has compiled the address of the run-time
routine, \forthb{(MAKE)}, followed by a zero. (We'll explain what the
zero is for, and why we save its address in a the variable
\forthb{MARKER}, later). % should probably be "save its address in the
variable..."
zero is for, and why we save its address in the variable
\forthb{MARKER}, later).
% should probably be "save its address in the variable..."
Now let's look at what \forthb{(MAKE)} does when we execute our new
definition \forthb{TEST}:
......@@ -87,7 +87,7 @@ definition \forthb{TEST}:
\verb%DUP 2+% & Gets the address of the second cell after
\forthb{(MAKE)}, where the address of \forthb{JOE} is.\\
\verb%DUP 2+% & Gets the address of the third cell after
\forthb{(MAKE)}, where the cod we want to
\forthb{(MAKE)}, where the code we want to
execute begins. The stack now has:
\parindent2ex (~'marker,~'joe,~'code~--{}--~)\\
......@@ -97,8 +97,8 @@ definition \forthb{TEST}:
the vector address goes.\\
\verb%!% & Stores the address where the new code
begins (\forthb{CR}, etc.) into the vector
address of \forth{JOE}.
Now \forth{JOE} points inside the definition of
address of \forth{JOE}. \\
& Now \forth{JOE} points inside the definition of
\forth{TEST}. When we type \forth{JOE}, we'll do a
carriage return.\\
\verb%@ ?DUP IF >R THEN%& Fetches the contents of the cell
......
......@@ -17,7 +17,7 @@ would \emph{not} be the case. The simpler, more compact form is therefore
preferable. Also in the first version, to add a new key would require a
change in two places.
\item The problem with the words \forth{RAM-ALLOT} and \forth{THERE} are
that they are \emph{time-dependent}: we must execute them ina particular
that they are \emph{time-dependent}: we must execute them in a particular
order. Our solution then will be to devise an interface to the RAM
allocation pointer that is not dependent on order; the way to do this is
to have a \emph{single} word which does both functions transparently.
......
......@@ -95,13 +95,13 @@ style\index{C!Commenting style|(}.
\setcounter{screen}{126}
\begin{Screen}
\ Formatter Data Structures -- p.2 06/06/83
6 CONSTANT TMARGIN \ line# where body of text begins)
55 CONSTANT BMARGIN \ line# where body of text ends)
6 CONSTANT TMARGIN \ line# where body of text begins
55 CONSTANT BMARGIN \ line# where body of text ends
CREATE HEADER 82 ALLOT
{ 1left-ent | 1right-cnt | 80header }
\ { 1left-ent | 1right-cnt | 80header }
CREATE FOOTER 82 ALLOT
{ 1left-cnt | 1right-ent | 80footer }
\ { 1left-cnt | 1right-ent | 80footer }
VARIABLE ACROSS \ formatter's current horizontal position
VARIABLE DOWNWARD \ formatter's current vertical position
......@@ -115,12 +115,12 @@ VARIABLE WALL-WAS \ WALL when curr. line started being formt'd
\ Formatter positioning -- p.1 06/06/83
: SKIP ( n) ACROSS +! ;
: NEWLEFT \ reset left margin
LEFT @ PERMANENT @ + TEMPORARY @ + ACROSS ! ;
LEFT @ PERMANENT @ + TEMPORARY @ + ACROSS ! ;
: \LINE \ begin new line
DOOR CR' 1 DOWNWARD +! NEWLEFT WALL @ WALL-WAS ! ;
DOOR CR' 1 DOWNWARD +! NEWLEFT WALL @ WALL-WAS ! ;
: AT-TOP? ( -- t=at-top) TMARGIN DOWNWARD @ = ;
: >TMARGIN \ move from crease to TMARGIN
O DOWNWARD ! BEGIN \LINE AT-TOP? UNTIL ;
O DOWNWARD ! BEGIN \LINE AT-TOP? UNTIL ;
\end{Screen}
\index{C!Commenting style|)}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment