| Forth (programming Language) |
Article Index for Forth |
Website Links For Forth |
Information AboutForth (programming Language) |
Forth is a Structured Imperative Stack-based Computer Programming Language and programming environment. Forth is sometimes spelled in all capital letters following the customary usage during its earlier years, although the name is not an Acronym . A Procedural , Stack-oriented and Reflective programming language without Type Checking , Forth features both interactive execution of commands (making it suitable as a Shell for systems that lack a more formal Operating System ) and the ability to Compile sequences of commands for later execution. Some Forth versions (especially early ones) compile Threaded Code , but many implementations today generate Optimized Machine Code like other language compilers. OVERVIEW Forth offers a standalone programming environment consisting of a Stack-oriented , interactive, incremental Interpreter and Compiler . Programming in Forth is an interactive, iterative process. A Forth system consists of ''words'' (the term used for Forth Subroutine s); new words are defined in terms of old words, and there is no distinction made between the words that define the Forth language and those that the programmer creates. A typical Forth package consists of a pre-compiled kernel of the core words, which the programmer uses to define new words for the application. The completed application can be saved as an image, with the new words already compiled. Generally programmers extend the initial core with words that are useful to the types of applications that they write, and save this as their working foundation. Forth uses separate stacks for storage of subroutine Parameter s and subroutine Activation Record s. The ''parameter'' or ''data stack'' (commonly referred to as the ''stack'') is used to pass data to words and to store the results the words return. The ''linkage'' or ''return stack'' (commonly referred to as the ''rstack'') is used to store Return Address es when words are nested (the equivalent of a Subroutine Call ), and store local variables. There are standard words to move data between the stacks, and to load and store named Local Variable s on the return stack. The logical structure of Forth resembles a Virtual Machine . Forth, especially early versions, implements an ''inner interpreter'' tracing Indirectly Threaded Machine Code , giving compact and fast high-level code that can be compiled rapidly. Many modern implementations generate optimized machine code like other language compilers. |
|
|