Gforth Manual

Gforth

This manual is for Gforth (version 0.7.0, November 2, 2008), a fast and portable implementation of the ANS Forth language. It serves as reference manual, but it also contains an introduction to Forth and a Forth tutorial.

Copyright © 1995, 1996, 1997, 1998, 2000, 2003, 2004,2005,2006,2007,2008 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.” (a) The FSF's Back-Cover Text is: “You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.”

--- The Detailed Node Listing ---

Gforth Environment

Forth Tutorial

An Introduction to ANS Forth

Forth Words

Arithmetic

Stack Manipulation

Memory

Control Structures

Defining Words

User-defined Defining Words

Interpretation and Compilation Semantics

Tokens for Words

Execution token: represents execution/interpretation semantics

Compilation token: represents compilation semantics

Name token: represents named words

Compiling words

Literals: Compiling data values

Macros: Compiling words

The Text Interpreter

Word Lists

Files

Search Paths

Other I/O

Locals

Gforth locals

Structures

Object-oriented Forth

The objects.fs model

The oof.fs model

The mini-oof.fs model

Programming Tools

Examining: Data and Code.

Forgetting words: Usually before reloading.

Debugging: Simple and quick.

Assertions: Making your programs self-checking.

Singlestep Debugger: Executing your program word by word.

C Interface

Assembler and Code Words

Tools

ANS Report: Report the words used, sorted by wordset.

Stack depth changes: Where does this stack item come from?

ANS conformance

The Core Words

core-idef: Implementation Defined Options

core-ambcond: Ambiguous Conditions

core-other: Other System Documentation

The optional Block word set

block-idef: Implementation Defined Options

block-ambcond: Ambiguous Conditions

block-other: Other System Documentation

The optional Double Number word set

double-ambcond: Ambiguous Conditions

The optional Exception word set

exception-idef: Implementation Defined Options

The optional Facility word set

facility-idef: Implementation Defined Options

facility-ambcond: Ambiguous Conditions

The optional File-Access word set

file-idef: Implementation Defined Options

file-ambcond: Ambiguous Conditions

The optional Floating-Point word set

floating-idef: Implementation Defined Options

floating-ambcond: Ambiguous Conditions

The optional Locals word set

locals-idef: Implementation Defined Options

locals-ambcond: Ambiguous Conditions

The optional Memory-Allocation word set

memory-idef: Implementation Defined Options

The optional Programming-Tools word set

programming-idef: Implementation Defined Options

programming-ambcond: Ambiguous Conditions

The optional Search-Order word set

search-idef: Implementation Defined Options

search-ambcond: Ambiguous Conditions

Emacs and Gforth

Installing gforth.el: Making Emacs aware of Forth.

Emacs Tags: Viewing the source of a word in Emacs.

Hilighting: Making Forth code look prettier.

Auto-Indentation: Customizing auto-indentation.

Blocks Files: Reading and writing blocks files.

Image Files

Fully Relocatable Image Files

gforthmi: The normal way

cross.fs: The hard way

Engine

Threading

Primitives

Cross Compiler

Licenses