version 1.82, 2000/08/26 13:29:47
|
version 1.83, 2000/08/26 14:06:10
|
Line 1410 gforthnrnh.fi -e bye} takes about 2.1ms
|
Line 1410 gforthnrnh.fi -e bye} takes about 2.1ms
|
@c what happens on redefinition |
@c what happens on redefinition |
@c parsing words (in particular, defining words) |
@c parsing words (in particular, defining words) |
|
|
|
The difference of this chapter from the Introduction |
|
(@pxref{Introduction}) is that this tutorial is more fast-paced, should |
|
be used while sitting in front of a computer, and covers much more |
|
material, but does not explain how the Forth system works. |
|
|
This tutorial can be used with any ANS-compliant Forth; any |
This tutorial can be used with any ANS-compliant Forth; any |
Gforth-specific features are marked as such and you can skip them if you |
Gforth-specific features are marked as such and you can skip them if you |
work with another Forth. This tutorial does not explain all features of |
work with another Forth. This tutorial does not explain all features of |
Line 3439 Reference: @ref{Word Lists}.
|
Line 3444 Reference: @ref{Word Lists}.
|
@chapter An Introduction to ANS Forth |
@chapter An Introduction to ANS Forth |
@cindex Forth - an introduction |
@cindex Forth - an introduction |
|
|
|
The difference of this chapter from the Tutorial (@pxref{Tutorial}) is |
|
that it is slower-paced in its examples, but uses them to dive deep into |
|
explaining Forth internals (not covered by the Tutorial). Apart from |
|
that, this chapter covers far less material. It is suitable for reading |
|
without using a computer. |
|
|
The primary purpose of this manual is to document Gforth. However, since |
The primary purpose of this manual is to document Gforth. However, since |
Forth is not a widely-known language and there is a lack of up-to-date |
Forth is not a widely-known language and there is a lack of up-to-date |
teaching material, it seems worthwhile to provide some introductory |
teaching material, it seems worthwhile to provide some introductory |
Line 3949 words of your own.
|
Line 3960 words of your own.
|
@c everything more complex again. I replaced it with ``default |
@c everything more complex again. I replaced it with ``default |
@c semantics'' (which is used elsewhere in the manual) by which I mean |
@c semantics'' (which is used elsewhere in the manual) by which I mean |
@c ``a definition that has neither the immediate nor the compile-only |
@c ``a definition that has neither the immediate nor the compile-only |
@c flag set''. I reworded big chunks of the ``how does that work'' |
@c flag set''. |
|
|
|
@c anton: I have eliminated default semantics (except in one place where it |
|
@c means "default interpretation and compilation semantics"), because it |
|
@c makes no sense in the presence of combined words. I reverted to |
|
@c "execution semantics" where necessary. |
|
|
|
@c nac-> I reworded big chunks of the ``how does that work'' |
@c section (and, unusually for me, I think I even made it shorter!). See |
@c section (and, unusually for me, I think I even made it shorter!). See |
@c what you think -- I know I have not addressed your primary concern |
@c what you think -- I know I have not addressed your primary concern |
@c that it is too heavy-going for an introduction. From what I understood |
@c that it is too heavy-going for an introduction. From what I understood |
Line 3960 words of your own.
|
Line 3978 words of your own.
|
@c that you need to understand to see how Forth works. That's unique and |
@c that you need to understand to see how Forth works. That's unique and |
@c worthwhile to emphasise. |
@c worthwhile to emphasise. |
|
|
|
@c anton: I think it's a good idea to present the details, especially those |
|
@c that you found to be a revelation, and probably the tutorial tries to be |
|
@c too superficial and does not get some of the things across that make |
|
@c Forth special. I do believe that most of the time these things should |
|
@c be discussed at the end of a section or in separate sections instead of |
|
@c in the middle of a section (e.g., the stuff you added in "User-defined |
|
@c defining words" leads in a completely different direction from the rest |
|
@c of the section). |
|
|
Now we're going to take another look at the definition of @code{add-two} |
Now we're going to take another look at the definition of @code{add-two} |
from the previous section. From our knowledge of the way that the text |
from the previous section. From our knowledge of the way that the text |
interpreter works, we would have expected this result when we tried to |
interpreter works, we would have expected this result when we tried to |
Line 7752 Directives}).
|
Line 7779 Directives}).
|
@c where it outlaws a style in common use. |
@c where it outlaws a style in common use. |
|
|
@c anton: it's more important to show what's portable. After we have done |
@c anton: it's more important to show what's portable. After we have done |
@c that, we can also show what's not. In any case, I intend to write a |
@c that, we can also show what's not. In any case, I have written a |
@c section Macros (or so) which will also deal with [ ]. |
@c section Compiling Words which also deals with [ ]. |
|
|
@code{[} and @code{]} also give you the ability to switch into compile |
@code{[} and @code{]} also give you the ability to switch into compile |
state and back, but we cannot think of any useful Standard application |
state and back, but we cannot think of any useful Standard application |