DPANS94

## American National Standard for Information Systems

# Programming Languages

# Forth

Secretariat
Computer and Business Equipment Manufacturers Association
Approved: March 24, 1994
American National Standards Institute, Inc.

Copyright (c) 1994 by Technical Committee X3J14. All rights reserved.

This is a working document of Technical Committee X3J14 which represents the last draft of ANS Forth submitted to ANSI for publication. Permission is hereby granted to copy this document provided that it is copied in its entirety without alteration or as altered by (1) adding text that is clearly marked as an insertion; (2) shading or highlighting existing text; and/or (3) deleting examples.

Specifically, permission is granted to use this working document as the foundation for textbooks, system manuals, and online documentation so long as the requirements in the preceding paragraph are met and the resulting product addresses a technical need that is not practically met by the official ANS.

NOTE:
  This file is provided as a working document of the TC for public review and comment as well as documentation uses described above. It is not intended as a substitute for the official ANS Forth document published by ANSI. In the event of conflict, only the printed document X3.215-1994 represents the official ANS Forth.

To obtain the official standard, please contact the American National Standards Institute Sales Department, at (212) 642-4900 or FAX (212) 302-1286, or Global Engineering Documents, at (800) 854-7179 or FAX (303) 843-9880, and request Document X3.215-1994. Thank you very much for your interest.

### HTML version 3.2

Editorial Notes
Requests for Interpretations

### Table of Contents

Foreword
X3 Membership
X3J14 Membership

1. Introduction

1.1 Purpose
1.2 Scope
1.3 Document organization
1.4 Future directions

2. Terms, notation, and references

2.1 Definitions of terms
2.2 Notation

2.2.1 Numeric notation
2.2.2 Stack notation
2.2.3 Parsed-text notation
2.2.4 Glossary notation

2.3 References

3. Usage requirements

3.1 Data types

3.1.1 Data-type relationships
3.1.2 Character types
3.1.3 Single-cell types
3.1.4 Cell-pair types
3.1.5 System types

3.2 The implementation environment

3.2.1 Numbers
3.2.2 Arithmetic
3.2.3 Stacks
3.2.4 Operator terminal
3.2.5 Mass storage
3.2.6 Environmental queries

3.3 The Forth dictionary

3.3.1 Name space
3.3.2 Code space
3.3.3 Data space

3.4 The Forth text interpreter

3.4.1 Parsing
3.4.2 Finding definition names
3.4.3 Semantics
3.4.4 Possible actions on an ambiguous condition
3.4.5 Compilation

4. Documentation requirements

4.1 System documentation
4.2 Program documentation

5. Compliance and labeling

5.1 ANS Forth systems
5.2 ANS Forth programs

6. Glossary

6.1 Core words
6.2 Core extension words

7. The optional Block word set

7.1 Introduction
7.2 Additional terms
7.3 Additional usage requirements
7.4 Additional documentation requirements
7.5 Compliance and labeling
7.6.1 Block words
7.6.2 Block extension words

8. The optional Double-Number word set

8.1 Introduction
8.2 Additional terms and notation
8.3 Additional usage requirements
8.4 Additional documentation requirements
8.5 Compliance and labeling
8.6.1 Double-Number words
8.6.2 Double-Number extension words

9. The optional Exception word set

9.1 Introduction
9.2 Additional terms and notation
9.3 Additional usage requirements
9.4 Additional documentation requirements
9.5 Compliance and labeling
9.6.1 Exception words
9.6.2 Exception extension words

10. The optional Facility word set

10.1 Introduction
10.2 Additional terms and notation
10.3 Additional usage requirements
10.4 Additional documentation requirements
10.5 Compliance and labeling
10.6.1 Facility words
10.6.2 Facility extension words

11. The optional File-Access word set

11.1 Introduction
11.2 Additional terms
11.3 Additional usage requirements
11.4 Additional documentation requirements
11.5 Compliance and labeling
11.6.1 File-Access words
11.6.2 File-Access extension words

12. The optional Floating-Point word set

12.1 Introduction
12.2 Additional terms and notation
12.3 Additional usage requirements
12.4 Additional documentation requirements
12.5 Compliance and labeling
12.6.1 Floating-Point words
12.6.2 Floating-Point extension words

13. The optional Locals word set

13.1 Introduction
13.2 Additional terms and notation
13.3 Additional usage requirements
13.4 Additional documentation requirements
13.5 Compliance and labeling
13.6.1 Locals words
13.6.2 Locals extension words

14. The optional Memory-Allocation word set

14.1 Introduction
14.2 Additional terms and notation
14.3 Additional usage requirements
14.4 Additional documentation requirements
14.5 Compliance and labeling
14.6.1 Memory-Allocation words

15. The optional Programming-Tools word set

15.1 Introduction
15.2 Additional terms and notation
15.3 Additional usage requirements
15.4 Additional documentation requirements
15.5 Compliance and labeling
15.6.1 Programming-Tools words
15.6.2 Programming-Tools extension words

16. The optional Search-Order word set

16.1 Introduction
16.2 Additional terms and notation
16.3 Additional usage requirements
16.4 Additional documentation requirements
16.5 Compliance and labeling
16.6.1 Search-Order words
16.6.2 Search-Order extension words

17. The optional String word set

17.1 Introduction
17.2 Additional terms and notation
17.3 Additional usage requirements
17.4 Additional documentation requirements
17.5 Compliance and labeling
17.6.1 String words

A. Rationale (informative annex)

A.1 Introduction
A.2 Terms and notation
A.3 Usage requirements
A.4 Documentation requirements
A.5 Compliance and labeling
A.6 Glossary
A.7 The optional Block word set
A.8 The optional Double-Number word set
A.9 The optional Exception word set
A.10 The optional Facility word set
A.11 The optional File-Access word set
A.12 The optional Floating-Point word set
A.13 The optional Locals word set
A.14 The optional Memory-Allocation word set
A.15 The optional Programming-Tools word set
A.16 The optional Search-Order word set
A.17 The optional String word set

B. Bibliography (informative annex)

Industry standards
Books
Journals, magazines and newsletters
Selected articles

C. Perspective (informative annex)

C.1 Features of Forth
C.2 History of Forth
C.3 Hardware implementations of Forth
C.4 Standardization efforts
C.5 Programming in Forth
C.6 Multiprogrammed systems
C.7 Design and management considerations
C.8 Conclusion

D. Compatibility analysis of ANS Forth (informative annex)

D.1 FIG Forth (circa 1978)
D.2 Forth-79
D.3 Forth-83
D.4 Recent developments
D.5 ANS Forth approach
D.6 Differences from Forth-83

E. ANS Forth portability guide (informative annex)

E.1 Introduction
E.2 Hardware peculiarities
E.3 Number representation
E.4 Forth system implementation
E.5 ROMed application disciplines and conventions
E.6 Summary

F. Alphabetic list of words (informative annex)