1、 INCITS/ISO/IEC 15145:19972010 (ISO/IEC 15145:1997, IDT) Information technology - Programming languages - FORTH Reaffirmed as INCITS/ISO/IEC 15145:1997 R2015INCITS/ISO/IEC 15145:19972010 PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this fil
2、e may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat
3、accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure tha
4、t the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date
5、 of ANSI Approval: 11/18/2010 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Copyright 2010 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organ
6、ization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior writ
7、ten permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1101 K Street NW, Suite 610, Washington DC 20005. Printed in the United States of America ii ITIC 2010 All rights reserved INTERNATIONAL STANDARD lSO/IEC 15145 First edition 1997-04-I 5 Information technology
8、 - Programming languages - Forth Technologies de /information - Langages de programmation - Forth Reference number ISO/IEC 15145:1997(E) ISO/IEC 15145:1997(E) Contents 1 General 1 1.1 Scope . 1 1.1.1 Inclusions 1 1.1.2 Exclusions . 1 1.2 Document organization . 1 1.2.1 Word sets . 1 1.2.2 Annexes .
9、2 1.3 Future directions . 2 1.3.1 New technology 1.3.2 Obsolescent features . G 1.4 Normative References . 2 2 Terms and notation 3 2.1 Definitions of terms . 3 2.2 Notation . 5 2.2.1 Numeric notation . 5 2.2.2 Stack notation 5 2.2.3 Parsed-text notation . 5 2.2.4 Glossary notation . 6 3 Usage requi
10、rements . 8 3.1 Data types 8 3.1.1 Data-type relationships 8 3.1.2 Character types 8 3.1.3 Single-cell types 10 3.1.4 Cell-pair types . 11 3.15 System types 11 3.2 The implementation environment . 12 3.2.1 Numbers 12 3.2.2 Arithmetic 12 3.2.3 Stacks 13 3.2.4 Operator terminal 14 3.2.5 Mass storage 1
11、4 3.2.6 Environmental queries . 14 3.3 The Forth dictionary 15 3.3.1 Name space 15 3.3.2 Code space . 15 3.3.3 Data space 15 3.4 The Forth text interpreter 17 3.4.1 Parsing . 18 3.4.2 Finding definition names . 18 3.4.3 Semantics . 19 3.4.4 Possible actions on an ambiguous condition . 19 3.4.5 Compi
12、lation .20 0 ISO/IEC 1997 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from the publisher. ISO/IEC Copyright Office
13、 l Case postale 56 l CH-1211 Geneve 20 l Switzerland Printed in Switzerland ii 0 ISOAEC ISOllEC 15145:1997(E) 4 Documentation requirements .2 1 4.1 System documentation .2 1 4.1.1 Implementation-defined options . .2 1 4.1.2 Ambiguous conditions .22 4.1.3 Other system documentation . .23 4.2 Program
14、documentation .23 4.2.1 Environmental dependencies .23 4.2.2 Other program documentation .23 5 Compliance and labeling .24 5.1 ANS Forth systems . .24 5.1.1 System compliance 2 4 5.1.2 System labeling . .24 5.2 ANS Forth programs . .24 5.2.1 Program compliance . .24 5.2.2 Program labeling . .24 6 Gl
15、ossary . 25 6.1 Core words .25 6.2 Core extension words 49 7 The optional Block word set . .59 8 The optional Double-Number word set .65 9 The optional Exception word set .70 10 The optional Facility word set .74 1 1 The optional File-Access word set .77 12 The optional Floating-Point word set . .87
16、 13 The optional Locals word set .102 14 The optional Memory-Allocation word set 107 15 The optional Programming-Tools word set . 1 10 16 The optional Search-Order word set 1 17 17 The optional String word set . .122 Annex A (informative) Rationale .125 A. 1 Introduction .125 A.2 Terms and notation
17、. 126 A.3 Usage requirements .127 A.4 Documentation requirements . ,138 A.5 Compliance and labeling . .138 A.6 Glossary 139 A.7 The optional Block word set .157 A.8 The optional Double-Number word set . .157 A.9 The optional Exception word set . .158 A. 10 The optional Facility word set . .16 1 A. 1
18、 1 The optional File-Access word set . .164 A. 12 The optional Floating-Point word set . 166 A. 13 The optional Locals word set . .169 A. 14 The optional Memory-Allocation word set .172 A. 15 The optional Programming-Tools word set . ,172 A. 16 The optional Search-Order word set .174 A. 17 The optio
19、nal String word set . 177 III ISOAEC 15145:1997(E) 0 ISOAEC Annex B (informative) Bibliography . 178 Annex C (informative) Perspective 180 C. 1 Features of Forth . 180 C.2 History of Forth 181 C.3 Hardware implementations of Forth . 18 1 C.4 Standardization efforts 18 1 C.5 Programming in Forth 182
20、C.6 Multiprogrammed systems . 188 C.7 Design and management considerations . 188 C.8 Conclusion 188 Annex D (informative) Compatibility analysis of ANS Forth . 189 D. 1 FIG Forth (circa 1978) . 189 D.2 Forth 79 189 D.3 Forth 83 189 D.4 Recent developments 190 D.5 ANS Forth approach . 190 D.6 Differe
21、nces from Forth 83 191 Annex E (informative) ANS Forth portability guide . 199 E.l Introduction 199 E.2 Hardware peculiarities 199 E.3 Number representation 201 E.4 Forth system implementation 202 E.5 ROMed application disciplines and conventions 203 E.6 Summary . 203 Annex F (informative) Alphabeti
22、c list of words 204 0 ISO/IEC ISO/IEC 15145:1997(EI Foreword IS0 (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of IS0 or IEC participate in the d
23、evelopment of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. IS0 and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-gover
24、nmental, in liason with IS0 and IEC, also take part in the work. In the field of information technology, IS0 and IEC have established a joint technical committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publi
25、cation as an International Standard requires approval by at least 75 % of the national bodies casting a vote. International Standard ISO/lEC 15145 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments and system
26、 software interfaces. Annexes A to F of this International Standard are for information only. V 0 ISOAEC ISOAEC 15145:1997(E) Introduction The purpose of this International Standard is to promote the portability of Forth programs for use on a wide variety of computing systems, to facilitate the comm
27、unication of programs, programming techniques, and ideas among Forth programmers, and to serve as a basis for the future evolution of the Forth language. Forth is a language for direct communication between human beings and machines. Using natural-language diction and machine-oriented syntax, Forth
28、provides an economical, productive environment for interactive compilation and execution of programs. Forth also provides low-level access to computer-controlled hardware, and the ability to extend the language itself. This extensibility allows the language to be quickly expanded and adapted to spec
29、ial needs and different hardware systems. Forth was invented by Mr. Charles Moore to increase programmer productivity without sacrificing machine efficiency. Forth is a layered environment containing the elements of a computer language as well as those of an operating system and a machine monitor. T
30、his extensible, layered environment provides for highly interactive program development and testing. In the interests of transportability of application software written in Forth, standardization efforts began in the mid- 1970s by an international group of users and implementors who adopted the name
31、 “Forth Standards Team”. This effort resulted in the Forth-77 Standard. As the language continued to evolve, an interim Forth-78 Standard was published by the Forth Standards Team. Following Forth Standards Team meetings in 1979, the Forth-79 Standard was published in 1980. Major changes were made b
32、y the Forth Standards Team in the Forth-83 Standard, which was published in 1983. The first meeting of the Technical Committee on Forth Programming Systems was convened by the Organizing Committee of the X3J 14 Forth Technical Committee on August 3, 1987, and has met subsequently on November 1 l- 12
33、, 1987, February lo- 12, 1988, May 25-28, 1988, August 10-13, 1988, October 26-29, 1988, January 25-28, 1989, May 3-6, 1989, July 26-29, 1989, October 25-28, 1989, January 24-27, 1990, May 22-26, 1990, August 2 l-25, 1990, November 6- 10,1990, January 29-February 2, 1991, May 3-4, 1991, June 16-19,
34、1991, July 30-August 3, 1991, March 17-21, 1992, October 13-17, 1992, January 26-30, 1993, June 28-30, 1993, and June 21, 1994. This project has operated under joint sponsorship of IEEE as IEEE Project P1141. The TC gratefully acknowledges the support of IEEE in this effort and the participation of
35、the IEEE members who contributed to our work as sponsored members and observers. Requests for interpretation, suggestions for improvement or addenda, or defect reports are welcome. They should be sent to the X3 Secretariat, Computer and Business Equipment Manufacturers Association, 1250 Eye Street,
36、NW, Suite 200, Washington, DC 20005. vi INTERNATIONAL STANDARD 0 ISO/IEC ISOllEC 15145:1997(E) Information technology - Programming languages - Forth I General 1.1 Scope This International Standard specifies an interface between a Forth System and a Forth Program by defining the words provided by a
37、Standard System. 1 .I .I Inclusions This International Standard specifies: - the forms that a program written in the Forth language may take; - the rules for interpreting the meaning of a program and its data. 1 .I .2 Exclusions This International Standard does not specify: - the mechanism by which
38、programs are transformed for use on computing systems; - the operations required for setup and control of the use of programs on computing systems; - the method of transcription of programs or their input or output data to or from a storage medium; - the program and Forth system behavior when the ru
39、les of this International Standard fail to establish an interpretation; - the size or complexity of a program and its data that will exceed the capacity of any specific computing system or the capability of a particular Forth system; - the physical properties of input/output records, files, and unit
40、s; - the physical properties and implementation of storage. 1.2 Document organization 1.2.1 Word sets This International Standard groups Forth words and capabilities into wordsets under a name indicating some shared aspect, typically their common functional area. Each word set may have an extension,
41、 containing words that offer additional functionality. These words are not required in an implementation of the word set. The “Core” word set, defined in clauses 1 through 6, contains the required words and capabilities of a Standard System. The other word sets, defined in clauses 7 through 17, are
42、optional, making it possible to provide Standard Systems with tailored levels of functionality. 1.2.1 .I Text clauses Within each word set, clause 1 contains introductory and explanatory material and clause 2 introduces terms and notation used throughout this International Standard. There are no req
43、uirements in these clauses. Clauses 3 and 4 contain the usage and documentation requirements, respectively, for Standard Systems and Programs, while clause 5 specifies their labeling. ISOllEC 15145:1997(E) 0 ISO/IEC 1.2.1.2 Glossary clauses Clause 6 of each word set specifies the required behavior o
44、f the definitions in the word set and the extensions word set. 1.2.2 Annexes The annexes do not contain any required material. Annex A provides some of the rationale behind the committees decisions in creating this International Standard, as well as implementation examples. It has the same numbering
45、 as the body of this International Standard to make it easy to relate each requirements clause to its rationale clause. Annex B is a short bibliography on Forth. Annex C provides an introduction to Forth. Annex D discusses the compatibility of ANS Forth with earlier Forths, emphasizing the differenc
46、es from Forth 83. Annex E presents some techniques for writing portable programs in ANS Forth. Annex F includes the words from all word sets in a single list, and serves as an index of ANS Forth words. 1.3 Future directions 1.3.1 New technology This International Standard adopts certain words and pr
47、actices that are increasingly found in common practice. New words have also been adopted to ease creation of portable programs. 1.3.2 Obsolescent features This International Standard adopts certain words and practices that cause some previously used words to become obsolescent. Although retained her
48、e because of their widespread use, their use in new implementations or new programs is discouraged, because they may be withdrawn from future revisions of this International Standard. This International Standard designates the following words as obsolescent: 6.2.0060 #TIB 15.6.2.1580 FORGET 6.2.2240
49、 SPAN 6.2.0970 CONVERT 6.2.2040 QUERY 6.2.2290 TIB 6.2.1390 EXPECT 1.4 Normative References The following standards contain provisions which, through reference in this text, constitute provisions of this International Standard. At the time of publication, the editions indicated were valid. All standards are subject to revision, and parties to agreements based on this International Standard are encouraged to investigat