Forth language summary

xiaoxiao2021-03-06  14

Forth language summary

Original author Peter Knaggs

Original title "Forth: an underview"

The purpose of this paper is to give a holistic contour of the Forth programming system, including the history of language, outstanding features and usage methods, discussing the most common implementation methods, but more importantly, the method of forth programming and philosophical thinking is discussed.

1.Forth's origin

According to the inventor Charles Moore (Chuck) of the Forth Language:

After I first combined various ideas into a whole, it works so effective in the "third-generation computer" IBM1130, so that I think it is "fourth-generation language", it should be known as FOURTH. However, the IBM computer at that time only allows the identifier of 5 characters. So Four has become Forth, which is a very good text game.

2. History

The Forth language was invented in the 1960s, when Moore made a computer programmer working in Stanford linear accelerator, and later became a free engineer. The engineering technicians at that time must learn a large number of methods in order to control compilers, including connectors, assembler, directives, and advanced languages. The goal of developing this new tool is to overcome these issues.

The first program called Forth is approximately written in 1970. The first complete implementation was completed on a PDP-11 in 1971, an 11-meter speculative telescope for Arizona National Availability. The responsibility of this system is directed and tracking the telescope, collecting data and records on the tape, supporting an interactive graphics terminal, providing the temporal analyzing the previous recorded data. The multitasking features of the system allow these functions to be executed simultaneously, no time and other conflicts.

This system has achieved great success, and astronomers around the world began requesting software copy. The FORTH has been rapidly expanded. The International Astronomical Society accepted Forth as a standard language in 1976.

The success of this application also promoted Moore and Elizabeth Rather (("BESS") FORTH, Inc. Company in 1973, the goal is to develop commercial applications in this language. Forth, Inc. developed multi-user Forth on small machines Version, can be used for scientific and application areas such as databases to image processing. Like the first application, they require combinations of different tools.

In 1977, the company has developed a version called "MicroForth" for the 8-bit processor that has just emerged, and the "miniforth" on the small machine has been extended and supplemented. In 1979, products called "Polyforth" replaced these systems. Since then, it has become the largest Forth system in the market.

The "MicroTH" system has achieved success in embedded microprocessor applications in the United States, Europe and Japan, resulting in a European Forth user group (EFUG); in 1978, it was established in the computer enthusiasts in Northern California. Interest organization (Fig).

FORTH system from the Observatory, use this system to develop a simple model, then implement it on several different systems (which is of course after the Forth, INC licenses) and sells very low prices. This model has later become a famous FORTH model. All of this makes it rapidly to Forth interest. FigG is currently 60 branches in 15 countries.

3. Features

Forth is an interactive programming environment, which was originally designed for programmers to develop applications on small and microcomputers. Earloose for science and industrial applications, such as instruments, robots, process control, graphics and image processing, artificial intelligence and business applications. The main advantage of FORTH is that software development is fast, interactive, and the computer hardware is efficient.

Forth is often used as a language, which is of course its most common, but the functions provided by Forth are more than traditional programming languages. Traditional advanced language tools contain a number of separate tools (compilers, editors, assemblers, etc.), Forth integrate them into one. Compared to traditional high-level languages, it is well thoughttable, completely uncommon syntax characteristics that do not have traditional advanced languages. The earliest implementation of Forth is a separate system that includes a general function of the independent operating system, as well as editor, compiler, assembler, debugger, and other tools. A single, simple, consistent rule dominate these capabilities. Today, although you can also see separate versions on many processors, more versions work with MSDOS, Windows, Unix operating systems.

Forth does not originate from other existing programming languages, so its appearance and internal characteristics are special for new users. But Forth's simplicity, high modularity and interactive features can make up for beginners' strangeness, making Forth very easy to learn and use. A new programmer usually takes some time to master the HuTH huge command set, through comprehensive use of a month, programmers can understand its entire internal work mechanism, what you have learned is more than traditional operating systems and compile More more.

The FORTH and traditional language is different from its scalability. The FORTH programming process is to define a new word, the word is actually a new command of the language. Words can be defined by a series of previously defined words, which is similar to educational children: we always use the concept of children to understand the concept of the children to children, and these words are called "advanced definitions". . Similarly, new words can also be defined by assembly code because all of the host processors are included in most Forth implementations, and these words are called Code words.

The result of scalability is that we have developed a special, "application-oriented language", which can be used, "for use,", which can be used for "application-oriented languages", which can be used for "application-oriented languages" for or after modification. .

The scalability of Forth is not just adding new commands to language itself, so don't define the definition of the definition letter to the traditional advanced language, the process is equivalent. Scalability can also create a word that can define other words, which is called a "definition word". When creating such a definition word, the programmer can specify the words it created in the compile time, runtime, or these two states. This capability allows us to define a special data type and fully controlled its behavior and structure. Also defined by the runtime behavior of this word can be defined in a high-level language or assembly language, the word created by the definition word will have the same performance as other Forth words. The system also allows us to add a new "Compilation Indicator" to achieve special types of loops or other control structures, such as Case structures.

4. Programming

Forth language and English are very similar, its basic elements are named data items, processes, and ability to create custom words for creating user data items. Procedures and definition words can be defined using previously defined words or assembly codes, which are similar to those of other languages, and is also equivalent to other languages. Forth allows us to be able to be entered on a keyboard, which will be executed immediately. However, if we put the name of the function in the definition, it will be compiled into a reference for this function.

The high-level word is defined by the collection of other words, we can imagine this process as a macro or English definition in the dictionary. The new word is added to the memory you can use, and its definition is added to the dictionary. In a naming rule of a Forth word, only few characters cannot be used as a named character. Many program organization uses a better naming convention, through the printed characters to increase the readability of the program.

When you encounter a word, Forth is a definition of this word through a dictionary search. If you find the functionality of this word or it is executed immediately, or it is compiled into a new definition. However, if this word is found in the dictionary, the system tries to convert it into a number. If the conversion is successful, put it on the stack. If you cannot convert into a number, you will show this word and print an error message to report that this word is not known. Forth adheres to the "structured programming" principle:

• The word must be defined before reference;

• Logic flow restrictions only in order, condition, and loops, with specialized words for implementing commonly used program control structures;

• Programmers use many small, independent modules (words) to achieve maximum testability and reliability;

This method has two obvious advantages

• The new word always constructs with previously defined and tested words, so it is easier to debug. The module can be performed separately to test its function;

• Inherent modularity makes Forth become a "design language" that allows the top-down design while maintaining the test from the bottom. One word can be used in different programs, but its function only needs to be defined;

These ensure that the Forth software is developed quickly and efficiently, and if management is proper, it can also be used as the basis of its own document.

The five main elements of Forth determine its characteristics:

• A dictionary;

• Two stacks, one is the parameter stack, the other is used for nested return stacks;

• Keyboard (input stream) interpreter;

• A assembler;

• Virtual storage;

Project developed with Forth

Here are some items developed using Forth

Many of ATARI's coin game consoles are developed in Forth. They believe that the fastest way to develop high-performance code is to use Forth, plus the use of assembly languages ​​to rewrite the innermost loop.

According to the recent conversation with famous Infocom's senior game developers, their game interpreter is also written in Forth.

Unison World has developed many games for the CP / M operating system, all written in Figage forth. According to the MARC DE GROOT of their technical director, put a Z80-based game to 6502 or MC6809, typical time is not more than 3 months.

The program of the Handheld baggage system of Federal Express Co., Ltd. is written in Forth. The project manager Gene Farrar said that he can upgrade the new firmware in a few weeks as needed, and other group maintenance C language code requires at least 6 months.

There are 3 in 4 loads in the Colombian space plane in November 1990 to program for Forth. According to Johns Hopkins University's Applied Physics Laboratory, one of the design teams, they choose Forth to solve hardware problems in flight, flexibility is a major factor.

Sun uses Forth for its workstation programmable boot ROM, shipped at speeds of 500-1000 sets per day, which is the largest number in the programmable FortH system. In 1994 IEEE 1275-1994 uses Forth for Boot (initial configuration) firmware standard, which is the basis of the Power PC universal hardware platform.

In the movie "Terminator II: World End", the trick effect of the Cyberdyne Systems T1000 system is based on the Morphing software package FORTH.

5. Dictionary

The Forth program is stored in the dictionary. The dictionary occupies a large part of the system memory, which consists of a variable length project of a series, and each item defines a word. Each defined content varies depending on the type of word (data item, constant, operation sequence, etc.), and the dictionary is scalable.

Word is incorporated by "Defining Word", the most commonly used definition word is: (colon). When the colon is executed, it creates a dictionary for the back word and then enters the Compile mode. There are many different compilation methods, the most commonly used "Series Code", which compiles the definition into an address reference for a series of previously defined words. Definitions; (semicolon) end. Below is a definition:

: NetWork (-) Open link TRXT. Echo close link;

Figure 1 Dictionary item

When a name item is compiled into the dictionary (called the defined head), it contains a pointer to the previous first header in the dictionary. The name of the new word is added to the dictionary (here is Network), then a pointer to the name "(:)" subroutine call to compile the first part of the definition, this pointer points to the code that needs to be executed when explaining the defined body . Of course, it is not the only compilation technology, but its application is most common, this technology is called indirect string code, because the first project in the definition is a code of a code, this code knows how to explain the definition Other parts.

The other part of the definition is called this defined body. In compilation mode, the system will look for the head of each word. Each header address is in turn in a defined body, which generates an address list. Finally, a subroutiner address called "exit" is compiled into definition. The EXIT subroutine is used to return control to call words, just like a subroutine returns.

6. Stack

Forth maintains two down-push stacks, and the down-push stack is also called a backward first list, which provides an effective mechanism of communication between the Forth word and logic control.

Although the structure of the two stacks is the same, their use is very different. The most close to the user / programmer relationship is the data stack, which saves the parameters passing between calls to replace the parameter list of the traditional language, and is also a valid internal mechanism for implementing the reuse. The second stack is a return stack for saving the return address of the nested definition, occasionally, is also used to temporarily save other data.

The use of the data stack results in a "suffix" representation method behind the operator. This suffix representation is often referred to as RPN or "reverse Polar representation" for commemorating Professor Lukasiewicz, in the 1920s. At Professor Lukasiewicz worked in Warsaw University, this method was developed for Sentential Calculus.

As an example, let's take a look at the word Blank. This word hopes that there is an address and one number on the stack. The word Blank will fill the specified number of ASCII spaces from the specified address, and:

Pad 25 blank

25 spaces will be filled in the Forth System's note area, where the address is placed on the stack by the word PAD. Application words are usually defined in a similar method, such as:

100 Samples

A data array for saving 100 measurements will be defined. The arithmetic operation is also taken from the stack and saves the results to the stack. For example, the operation adds two numbers of the top of the stack and uses them and replaces the top of the stack. Since the results of the operation remain in the top of the stack, the continuous operation can be combined without a temporary storage variable. For example, expressions

TEMPN (Reading% Interval / Interval) * (TEMPN1 - TEMPN) becomes:

Reading Interval% Interval / Tempn1 Tempn - * TEMPN

7. Interpreter

FORTH is essentially an interpretation system, in which the execution of the program is controlled by the data item instead of machine code. The interpretation system is usually very slow, but Forth has maintained the high speed required for real-time applications by two levels of interpretation. Of course, let's say that it is assumed that the system uses a normal string coding method. If compiling technology is used to generate local code, there will be no loss at all.

• The first interpreter is a text interpreter that scans the string obtained from the terminal (or from a mass storage) and finds each word in the dictionary. If this word is found, it is performed by the second level address interpreter.

• The second-level interpreter is an "address interpreter". Although not all systems are implemented in this way, this method is the earliest and most basic method, and the address interpreter handles the address (or tag) string by executing each definition point, these definition points are Create and compile them from: (colon).

7.1 Text Interpreter

After powering. Forth starts a unlimited loop called quit. This is the Forth text interpreter, also known as a keyboard interpreter.

: Quit (-) Begin Reset Query Interpret Again;

RESET Clear Stack, Query Wait for the user to enter a command from the keyboard (or from a mass storage device), the interpret looks for a dictionary, and then execute. Begin and Again are program control words for constructing infinite loops.

The Quit loop provides the "interactive" feature of the language. If you enter a command, it can be performed immediately, and the result of the execution can use the same text interpreter to observe. With other editing - compile - link - a new test program development process, a new definition can be repeatedly tested and tested repeatedly in a very short time.

7.2 address interpreter

The last field of the definition item is the code pointer to the function execution. The address in which the field is located is called "code domain address", referred to as CFA. This address is the address of the address interpreter for all Forth Advanced Definition Words (using: Call registration).

The address interpreter has a register i, which contains the address of the next entry in the executed list. This entry is a CFA address of a word, which is called by the advanced definition word currently executed. It is CFA that determines the properties (or type) of a word.

In the example below, word a call word B, word B call word X, etc. The CFA is saved in the intermediate register W. The FORTH encoding mode of this two-stage indirect addressing and dictionary list structure is also referred to as "indirect string coding".

Figure 2 Interconnial Case Coding

The address interpreter reads I and uses the next address in the list to read the code from W and execute the code indicated by it. I Automatic increment points to the next entry in the list, because the first entry is CFA, so I now point to the defined body. This is very useful for the data structure of the lookup table, because the definition is the storage area of ​​the table element. In the case of advanced definitions, the code domain address points to the subroutine (:), which saves the current i on the returns, then loads I and repeats this process. At the end of the advanced definition, word exit is executed, restored the original I value, and the program continues to be executed like before. These three action "read I pointers, save I pointers, and restore I pointers" is the basic mechanism for the address interpreter. The address interpreter has three important features:

• Special fast. Although the actual speed is dependent on a particular implementation, the professional implementation is highly optimized, and each address usually requires 1-2 machine characters. This is more than 0% -50% overhead than the pure assembly code. In many baseline procedures, good Forth is far more than an interpretation language such as Basic or LISP, which can be compared to other compilation advanced languages;

• It makes the Forth definition extremely tightened, and each reference only needs one unit (you can understand the unit into a machine word, but "word" refers to a definition item in Forth). As a comparison, we can consider the subroutine call structure generated by many advanced languages: a Call or JSR instruction, followed by the address, before and after this, there is a parameter sequence access instruction.

• Methods to save addresses using Return Stacks are transparent to programmers, words can also be nested in multiple layers as needed, such advanced definition word sequences can be automatically processed without requiring special code.

Many words in the Forth system are defined and interpreted by an address interpreter, and many Forth systems themselves are defined by this method.

8. Assembler

Most Forth systems include a macro-compilation, assemble language programming for their CPU. By using the definition word code, the programmer can create a definition of the actual machine code. CODE definitions can be used to complete I / O, arithmetic primitives, and other processing functions that depend on the machine (time urgent). When the programmer uses CODE, he has a complete control capability with the CPU as other assembler, and the word defined by the Code is run at full speed.

This is an important feature of Forth. It allows those who obviously dependent on the machine to transform into manageable pieces through machine-independent interface. When we need to transplant the application to a different processor, we only need to rewrite the Code word, which can be interacted with the other Forth word strictly in the same way.

The Forth assembler itself is also extremely tight (typically 1k bytes), which can be resident in the system with compilers, editors, and other programming tools. This means that programmers can be found in a very short code definition, then perform them immediately, this ability is especially useful when debugging the customer hardware.

9. Virtual storage

Forth's last unique composition element uses a disk (or other massive memory) in a manner in which data and source virtual memory are pressed. In the case of an address interpreter, this method is typical in history, but is not universal now. The disk is divided into a block of 1024 bytes, and two or more buffers are prepared in memory, and the data is automatically read into the buffer when referenced. Each block has a fixed block number directly corresponding to the physical location of the local storage system. When the program needs to be accessed at any time, it will find data in memory and do not need explicit read and write operations.

Such a block-oriented disk management method is simple and efficient for the implementation of the FORTH independent system, and the result is a completely transparent mechanism for the source program and data processing in the FORTH implementation of the independent and collaborative resident FORTH. The definition in the source block is compiled into memory through the load command. Many systems include an editor that organizes each block to a 64-character 16 line display mode and provides a command to modify the source.

The source block is an important component of the Forth style in history. Just like the definition of Forth can be considered as a sentence in a natural language, a block is equivalent to a paragraph, which typically contains definitions related to one topic, such as "vector processing". In an comment description of the top row of block text, the application can select the installed block by actual needs.

Blocks are also used to store data. Small records can be combined into a block, and large records can also be distributed in several blocks. The programmer can distribute blocks according to the needs of the application, and the independent Forth system can organize data to optimize the system at least in the principle of minimal movement, and several developers provide Forth block and database systems.

The Forth version running over the host operating system uses the file system to implement block mechanisms, and also provides a general file operation method based on an operating system environment.

10. Data structure

All high-level words share the same data structure, the header of this word contains the text interpreter to identify data information required for one word, as shown in Figure 3.

Figure 3 definition of the first

The "LINK" field contains the first address of the previous command in the dictionary, which needs this address when searching the dictionary.

The Name Length field contains the number of all characters in the name, followed by these characters, requires this data when the name matches during the interpretation process. Many Forth systems only store the first 3 characters of the name, which can avoid name conflicts in the case where the space is minimized, and many system name length allows you to choose between 3-31 characters.

This explanator starts processing from the last entry of the dictionary, and looks back along the linked list until the matching name. There are also many systems with a hash algorithm that divide the dictionary into several tables, and only one of them each time, this way can greatly save time.

"Code Pointer" is the CFA of the first instruction that this word will be executed, which forms the first entrance to the definition. It is also the address of the code, this address interpretation defines other parts, points to different code for different data structures.

Figure 4 Different data types pointing behavior is also different

The other part of the word is the definition body, which varies depending on the data type, as shown in Figure 4:

• In the Code Definition, the body contains a list of machine operators that define the command behavior, so the CFA contains the address of this body;

• In a data structural command such as Varible and Constant, the word-known body contains actual data. The CFA contains the entry address of the subroutine required to process the data, and the user-defined data structure is shown in FIG.

• In the advanced: (colon) definition, the body of the word contains an address list that makes up all previous defined words that define this definition. CFA is the address of the address interpreter (:).

11. Application example

Below is a typical FortH source sequence block. This application is used to control 8 LED prompts, which also illustrate how the FORTH definition is combined to form an application environment.

Figure 5 A source program block

Note Note Note The attributes of the other words listed in this block are often referred to as an indexed line. Most Forth systems have a command word to find the first line of the block to find which block is required for the application.

All LEDs are accessed by an 8-bit port located at address 40h. This location is given by the constant definition of the first line, so this port can be referenced by the name, and if the hardware address is changed later, we only need to adjust this constant. The word Lights returns this address on the stack, defines the light to get the top value and send it to the device. The attribute of this value is a bit mask, and each bit corresponds to an LED. So: 255 Lights

Will light all the lamps, and the command

0 Lights

All lights will be closed. If the hardware changes, we only need to rewrite the word Lights to accommodate new hardware, and other parts of the application do not need to make any changes.

The line 4-6 contains processing on our terminal input, and the terminal input is to make a simple diagnosis to confirm that every aspect can be operated normally. Here DELAY contains the delay time in microseconds, and executes delay returns the address of this variable. DELAY's two values ​​are defined by fast and slow, using Forth's operation! (Reading Store) Gets the address and value from the top of the stack and stores the value into the corresponding address.

Define Count Run a loop from 0-255 (between words DO and LOOP). The word i places the current value of the loop on the top and sends it to the lights. The system will then wait for the time specified by delay.

Word @ (read fetch) reads a value from the address provided by Delay and gives this value to MS waiting for a specified millisecond. The result of executing count is counted between 0 and 255 at a specified rate. Can call this:

Slow Count or

Fast Count

8-10 rows provide a separate named lamp. In this application, they are used as the indicator of the lamp. Word LAMP is a definition word using a bit mask as a parameter. Word CREATE puts a header into the dictionary, simultaneously, (comma) put the mask into the defined body. Words DOES> Put the code address in the CFA of the new word. So when the new word is executed, its action is to get the content of the first item in the defined new font.

Rows 9 and 10 use LAMP to name special indicators. When one of the words is executed, the mask is returned to the top of the stack. In fact, this behavior is the same as the Forth word cosntant. But LAMP is an example, using create ... does> Defining the ability to define the word is one of the most powerful features of the Forth language, which allows us to define the "smart app" based on the data structure.

Finally, line 13-15, we have the word of the control light panel. LAMPS is a variable that contains the current state of the lamp. Word Lamp-ON gets a mask (provided by one of the LAMP words), then light up. LAMP-OFF turns off the specified lamp while changing the status of the LAMPS.

Other places in the application, the name of the lamp and Lamp-ON, Lamp-Off may be the word that needs to be executed. Usage is:

Power Lamp-ON or

Sampling lamp-off

Compiling this code block on the system is approximately half a second, including the time read from the disk. Such a programmer may simply put a definition and execute it immediately. In addition, we always have the ability to communicate with external devices. We can first entered:

HEX FF 40 OUTPUT

To see if all the lights are bright. If not, you can assume that some addresses are not right, because the above sentence is sent to the device all 1. This type of interaction is especially useful when dealing with hardware, which can shorten the development time of hardware.

12. Expand

Since Forth is scalable, a large number of developers provide many extended products for Forth language applications. These extensions include automated documents, terminal drivers, disk file management, database management, target compilers, cross compilers, and META compilers. A target compiler allows us to write system programs such as a host CPU such as a PC. The program can be tested and interactively tested by keyboard, which can then be compiled into the target environment and generate corresponding ROM code. One function of the target compiler is to eliminate unwanted code in the target system, such as editor, compiler, and assembler. Through these work, the ROM overhead of the operating system can be reduced from the 8K bytes occupied by the development system to approximately 600 bytes.

The cross-compiler is similar to the target compiler, which allows the user to develop and test code on the host, and then cross the cross-compiler compile the Forth system as the target compiler, just the cross-compiler is using different machine languages, for different target CPUs Generate code. This feature allows for quick development of new Forth systems for new CPUs, because the Forth system is mainly written in the Forth language, so we only need to write a assembler for new processors, then perform Forth system for new processors. Cross-compilation is possible. Most Forth systems are developed in this way. As a result, Forth is usually one of the preferred languages ​​on a new processor.

The process of writing a Forth compiler is also known as Meta compilation.

13. Multi-task

Multi-task is in Forth. These systems are not just the language processor, but also the characteristics of the operating system, and many integrated systems are completely running independently, perform all operating systems.

Forth's operating environment runs fast, so Forth-based systems can support multi-user and multitasking, even in computer hardware that seems to be unable to implement these features. For example, a manufacturer of a telephone exchange plate performs 50 tasks on a Z80. There are also several multitasking products on the IBM PC, and some can even support multiple users. On a computer that typically supports multi-user operation, the number of users can support more, a database application system running on a single MC68000 processor supports 100 terminal updates and database requests, but the running speed is not significantly reduced. .

Multi-user systems can support multiple programmers at the same time, each programmer has its own private dictionary, stack, and a series of variables to control tasks. Private dictionary is connected to a shared, renewable, contains a dictionary that all standard Forth features. Private dictionaries can be used to develop application code, which can be added to the shared dictionary later.

Figure 6 shows a typical method of the Forth system implementing multiple tasks. This is a "rotation scheduling algorithm" scheduler, which is the most commonly used method for multi-tasking in the Forth system. However, there are some implementation of time tablet scheduling or priority-based scheduling and other deprivable algorithms, each task has its own user area to save control variables, private dictionaries, and stacks. The first field of the user area is the Status variable. This variable has two possible values: awake or sleep.

Figure 6 4 tasks in the loop schedule

The tasks that can be selected to be executed must be in a wake-up state. When the task is selected, its state is reset to the sleep state. The task has been executed until the scheduler executes the word PAUSE, which will set the status of the task to wake up, and the control is re-returned to the scheduler. When the scheduler is round to this task again, will continue to execute from the PaUSE instruction.

In addition to the PAUSE word, the task can also perform the STOP word to return control to the scheduler. This is similar to PAUSE, but the status of the task does not switch to the wake-up state. In this way, when the scheduler is round to this task again, the current state is still sleeping. This means that this task cannot be performed anymore, unless its status is set to wake up by another task or interrupt.

The system is programmed in this way and interrupts. When an interrupt occurs, some of the code-related code set the specified task status as awakening, which will be executed when the scheduler reaches these tasks again. When the task is executed, the Status variable is set to sleep, which allows an interrupt when a task is performed. Therefore, if a task executes the STOP instruction and its state has not changed, in which an interrupt setting has set it to wake up, it can be scheduled again, so we can buffer an interrupt. However, this means that when a task actively discards the processor and hopes that the next dispatch continues to execute, it must set the status to wake up. The rotary scheduler uses the address stored in the LINK user variable as the address of the next task. If the status of this task is awake, the task will be scheduled, otherwise, the scheduler takes out its LINK address to the next task.

This method has two main issues:

• When a task actively discards the processor for other tasks, it is uncertain when the processor is discarded.

• Interrupt Setting One Task is not known to awakening status to this task actual execution.

By carefully using PAUSE, coupled with Forth's running speed, these problems have been overcome in the main application system.

14.Forth hardware

As early as 1980, Rockwell produced a 65F11 processor, which is a 6502 processor variant that cures Forth primitive in the ROM of 6502 chips, which is successfully applied to many embedded systems.

In 1981, Chuck Moore began to design a Forth virtual machine chip. This work is first in Forth, Inc., and later set up a company to develop this chip. 1984 Completed design, produced the first sample in 1985. Later, Harris (Intersil), Johns Hopkins University and other people also developed FORTH hardware. FORTH-based chip provides extremely high performance, typically compared to the RSIC chip, but it does not have traditional RISC programming complexity.

15. Standard

The FortH community recognizes that it takes a standard that makes the application and extensions. The first such standard began from the mid-1970s Mid-Fig (Forth Interest Organization), which later became the FIG-FORTH standard.

The first major FORTH standard comes from a meeting in Utrecht in 1977 that participants put forward a primitive standard and agreed to continue meeting discussions, including FIG members, through a series of users and development The meeting has produced a broader standard called Forth-79.

Although the influence of Forth-79 standard is huge, many Forth users and developers have found some fatal disadvantages in this standard. In 1983, two further meetings produced FORTH-83 standards.

Encourse-received encouragement by the FORTH-83 standard, a group of users and developers start from 1986 to discuss the feasibility of US national standards. The National Standard Forth Technical Committee, also known as the ANS ASC X3 / X3J14 Committee, held the first meeting in 1987 to "reach an acceptable standard, was accepted by the main developers of Forth products, for existing The adverse effect is the smallest. " In 1994, it was about 7 years later, the new standard finally produced, this is the farthest in all standards. Use the description from 5 countries to open to the public through developers. Two years later, the International Standardization Organization accepts this standard for international standards.

16. Seminar and regular publications have continuously developed due to their work and constant extension because people use Forth. Three years will pay attention to the development of the Forth language:

Forth Modification Laboratory (Forml)

Held at Mt. View in California and ORGANISED by The Forth Interest Group.

Rochester Forth Conference (RFC)

Held At The University of Rochester in new york and organizationed by The Institute for Applied Forth research Inc.

European Forth Conference (EuroForth)

held in a different location each year. This is the only conference to provide a refereed (peer reviewed) section. Originally organised by the European Forth Interest Group, but now organised by various European based Forth vendors.

Many new ideas for Forth have appeared on these Forth-related magazines:

Forth Dimensions (Issn 0884-0822)

Published Six Times a year by the forth intert group for its members.

Journal of Forth Application And Research (Issn 0738-2022)

published irregularly by the Institute for Applied Forth Research Inc. This is the only peer review (refereed) journal directed to the Forth language. The Journal is now published electronically on the Internet. A paper version of the Journal will be published at irregular intervals.

17. Summary

Froth can be seen as two stacks (parameter stacks and return stacks), with processors that are extended assembled. The Forth interpreter can be seen as a complete macro-comparator for this abstract processor and a fully integrated operating system.

This gives us an interactive debug environment that allows us to add new macros (advanced definitions) and new instructions (low Code definition). It even allows us to extend the macro system itself by defining a new data type (using the definition word crete ... does>). Because this interpreter is also a full-featured operating system, the programmer only needs to learn a tool.

Forth has four direct advantages: goodwill, direct, scalable and economical. It also has two indirect advantages: understandable and symbolized.

Forth is more than just a language, but it is a philosophical idea for solving problems. This can be summarized with an abbreviation K.I.s.s (Keep IT Simple and Stupid, keeping it simple and easy). We can quote Jerry Boutelle (Owner of Nautilus Systems in Santa Cruz, California), when asked "How to influence your thinking with Forth", he replied:

"Forth has changed my thinking in many ways. From learning forth, I have used various language programming, including compilation, Basic, Fortran. I found that I have been using Forth's problem decomposition, by creating word They are combined. For example, when processing a string, I will define subroutines like Forth's cmove, -trailing, and fill. Correctly, Forth has firmly believes in simplicity. I have a problem. Many people use a particularly complex tool, but simple tools can also be used and more useful. I tried to simplify the square of my life. "Here I quote a Chinese philosopher Laozi:

"To learn more, the day damage"

Or reference Antoine Lavoisier (1789):

"Separation of science and language is impossible, because every natural science always contains three things: a series of phenomena based on the science, named these phenomena, expressing these concepts. For explanation A concept, we need a vocabulary; in order to describe a phenomenon, we need a concept. All these three things reflect the same reality. "

This is the philosophy that is included behind the Forth language.

18. References

Slightly (see the original text)

转载请注明原文地址:https://www.9cbs.com/read-49792.html

New Post(0)