IamRob wrote:
Now I am a confused by the word "standard". Is it if certain words are included in the Forth System that makes the standard? FIG Forth follows the 79 standard, but I have adopted words from the 83 and ANS standards. Does that make my version of FIG an 83 standard?
Forth's extensibility allows the language to be expanded and it doesn't matter if you get the new words from another standard or think them up yourself. As for following a certain standard such as the Forth-83 standard, the standard has a required word set. These are words that must be in a Forth-83 system for it to claim compliance. Each word in the required word set must also behave according to the standard. For example, EXPECT takes from the stack the address to store a received string and the count ( the maximum number of characters to receive ). EXPECT saves the number of characters actually received in a variable named SPAN. The Forth-83 Standard also specifies a double number wordset, assembler extension word set, system extension word set, and a list of controlled reference words. The words in the controlled reference words may be included ( some or all ), but don't have to be. Any words included from this list must have the standard behaviour for the system to be compliant. There is also a list of uncontrolled reference words. Any words from this list can be included. Such words do not have to have the behaviour specified in the standard, but conformance to the behaviour specified in the standard is advised.
As for adding words from other standards, that's not a problem ( with compliance ) as long as the words don't conflict with the standard you are following. If, for example, you preferred that EXPECT left a count of received characters on the stack, you can not change it to do that while claiming conformance to the Forth-83 standard. The Ansi Standard does have a word that will do that. It is ACCEPT. ACCEPT can be defined on a Forth-83 system as:
Code:
: ACCEPT ( ADR CNT1 -- CNT2 )
EXPECT SPAN @ ;
There is no conformance issue because the Forth-83 Standard does not have a word named ACCEPT.
Another matter that has been addressed on this forum, if you are adding a word to your system and it already has a standard name somewhere, even if it is just a defacto standard, it is best to use that name. For example, on my Forth-83 system, I had the word UNDO . It would discard the parameters of a DO LOOP so one could exit that word from within the DO LOOP . The word UNDO is not in the Forth-83 Standard, nor is its behaviour. There is, however, a word in the Ansi Forth Standard that does the same thing. It is named UNLOOP . Although my system is a Forth-83 system and not an Ansi Forth system, I renamed UNDO to UNLOOP because the name UNLOOP for that behaviour was a kind of defacto standard.
Quote:
GraForth follows the 78 standard but uses text files to read and write to. FIGForth uses screens. If I adopt the text file way. Does that lower my standard?
The words BLOCK and BUFFER are in the required word set so if you were going for Forth-83 compliance your system would be a subset of the Forth-83 standard. I don't think that part will be a big deal as it won't affect portability of applications, unless the application in question has a dependency on BLOCK or BUFFER . Blocks are not just for source code. They can also store binary data.
Quote:
If by "between your Forth and another", do you mean on the same computer?
Not necessarily.
Quote:
The purpose of this standard is to allow transportability of
FORTH-83 Standard Programs in source form among FORTH-83 Standard
Systems. A standard program shall execute equivalently on all
standard systems.
Quote:
I believe FIGForth has the highest standard as well as words that support the latest Operating System for the Apple II platform. But there are certain words that I would like to port over from some of the older Forths.
I don't think FigForth is so much a standard as it is an implementation model and it is one of the older Forths ( older than the Forth-79 Standard).
Quote:
Most of the words just pertain to the platform I am using and really can't be part of any standard, like the use of expanded memory, graphics or Operating System.
All Forths will have parts that are system dependent. One of Forth's strengths is the ability to get at the hardware and exploit your machine's capabilities in whatever way is most efficient for your machine.