www.delorie.com/gnu/docs/gforth/gforth_fot.html   search  
Buy GNU books!

Gforth Manual

[Top] [Contents] [Index] [ ? ]



However, in 1998 the bar was raised when the major commercial Forth vendors switched to native code compilers.


i.e. it is stored in the user's home directory.


This notation is also known as Postfix or RPN (Reverse Polish Notation).


therefore it's a good idea to avoid ) in word names.


We can't tell if it found them or not, but assume for now that it did not


That's not quite true. If you press the up-arrow key on your keyboard you should be able to scroll back to any earlier command, edit it and re-enter it.


Actually, there are some subtle differences -- see 5.13 The Text Interpreter.


For example, `/usr/local/share/gforth...'


It's easy to generate the separate notation from that by just separating the floating-point numbers out: e.g. ( n r1 u r2 -- r3 ) becomes ( n u -- ) ( F: r1 r2 -- r3 ).


Sometimes, the term dictionary is used to refer to the search data structure embodied in word lists and headers, because it is used for looking up names, just as you would in a conventional dictionary.


To be precise, they have no interpretation semantics (see section 5.10 Interpretation and Compilation Semantics).


well, not in a way that is portable.


Well, often it can be -- but not in a Standard, portable way. It's safer to use a Value (read on).


Strictly speaking, the mechanism that compile, uses to convert an xt into something in the code area is implementation-dependent. A threaded implementation might spit out the execution token directly whilst another implementation might spit out a native code sequence.


It is legitimate both to read and write to this data area.


Exercise: use this example as a starting point for your own implementation of Value and TO -- if you get stuck, investigate the behaviour of ' and ['].


In standard terminology, "appends to the current definition".


In standard terminology: The default interpretation semantics are its execution semantics; the default compilation semantics are to append its execution semantics to the execution semantics of the current definition.


For a more detailed discussion of this topic, see M. Anton Ertl, State-smartness--Why it is Evil and How to Exorcise it, EuroForth '98.


Depending upon the compilation semantics of the word. If the word has default compilation semantics, the xt will represent compile,. Otherwise (e.g., for immediate words), the xt will represent execute.


A recent RFI answer requires that compiling words should only be executed in compile state, so this example is not guaranteed to work on all standard systems, but on any decent system it will work.


This is an expanded version of the material in 4.1 Introducing the Text Interpreter.


When the text interpreter is processing input from the keyboard, this area of memory is called the terminal input buffer (TIB) and is addressed by the (obsolescent) words TIB and #TIB.


This happens if the word was defined as COMPILE-ONLY.


In other words, the text interpreter processes the contents of the input buffer by parsing strings from the parse area until the parse area is empty.


This is how parsing words work.


Exercise for the reader: what would happen if the 3 were replaced with 4?


For example, 0-9 when the number base is decimal or 0-9, A-F when the number base is hexadecimal.


Some Forth implementations provide a similar scheme by implementing $ etc. as parsing words that process the subsequent number in the input stream and push it onto the stack. For example, see Number Conversion and Literals, by Wil Baden; Forth Dimensions 20(3) pages 26--27. In such implementations, unlike in Gforth, a space is required between the prefix and the number.


The ANS Forth definition of buffer is intended not to cause disk I/O; if the data associated with the particular block is already stored in a block buffer due to an earlier block command, buffer will return that block buffer and the existing contents of the block will be available. Otherwise, buffer will simply assign a new, empty block buffer for the block.


In compiler construction terminology, all places dominated by the definition of the local.


This feature is also known as extended records. It is the main innovation in the Oberon language; in other words, adding this feature to Modula-2 led Wirth to create a new language, write a new compiler etc. Adding this feature to Forth just required a few lines of code.


Moreover, for any word that calls catch and was defined before loading objects.fs, you have to redefine it like I redefined catch: : catch this >r catch r> to-this ;


This is Self terminology; in C++ terminology: virtual function table.


A longer version of this critique can be found in On Standardizing Object-Oriented Forth Extensions (Forth Dimensions, May 1997) by Anton Ertl.


This isn't portable, because these words emit stuff in data space; it works because Gforth has unified code/data spaces. Assembler isn't likely to be portable anyway.


In my opinion, though, you should think thrice before using a doubly-linked list (whatever implementation).


The Unix kernel actually recognises two types of files: executable files and files of data, where the data is processed by an interpreter that is specified on the "interpreter line" -- the first line of the file, starting with the sequence #!. There may be a small limit (e.g., 32) on the number of characters that may be specified on the interpreter line.


Unfortunately, long longs are not implemented properly on all machines (e.g., on alpha-osf1, long longs are only 64 bits, the same size as longs (and pointers), but they should be twice as long according to see section `Double-Word Integers' in GNU C Manual). So, we had to implement doubles in C after all. Still, on most machines we can use long longs and achieve better performance than with the emulation package.


We use a one-stack notation, even though we have separate data and floating-point stacks; The separate notation can be generated easily from the unified notation.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003