<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Forth</id>
	<title>Forth - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Forth"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Forth&amp;action=history"/>
	<updated>2026-07-18T22:31:32Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=Forth&amp;diff=543&amp;oldid=prev</id>
		<title>2025年12月26日 (五) 14:43 imported&gt;ExultantEditor</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Forth&amp;diff=543&amp;oldid=prev"/>
		<updated>2025-12-26T14:43:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{NoteTA&lt;br /&gt;
|G1 = IT&lt;br /&gt;
}}&lt;br /&gt;
{{Infobox programming language&lt;br /&gt;
| name            = Forth&lt;br /&gt;
| paradigm        = [[面向堆栈编程|面向堆栈]]、[[过程式编程|过程式]]、[[反射式编程|反射式]]、[[串接编程语言|串接]]&lt;br /&gt;
| year            = {{start date and age|1970}}&lt;br /&gt;
| designer        = [[Charles H. Moore]]&lt;br /&gt;
| typing          = 无类型&lt;br /&gt;
| implementations = SwiftForth (Forth, Inc.)&amp;lt;br&amp;gt;{{le|Gforth|Gforth}} (自由软件)&amp;lt;br&amp;gt;VFX Forth (微处理器引擎)&lt;br /&gt;
| influenced_by   = {{le|Burroughs大型系统|Burroughs large systems}}, [[Lisp]], [[APL语言|APL]]&lt;br /&gt;
| influenced      = [[Factor (编程语言)|Factor]], [[Joy (编程语言)|Joy]], [[PostScript]], {{le|RPL (编程语言)|RPL (programming language)|RPL}}, [[REBOL]]&lt;br /&gt;
| file_ext = .fs, .fth, .forth&lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Forth&amp;#039;&amp;#039;&amp;#039;是1960年代末期，由[[查理斯·摩爾 (程式設計師)|查理斯·摩爾]]发展出来在天文台使用的電腦[[控制系統|自動控制系統]]及[[程序设计语言]]&amp;lt;ref name=&amp;quot;evolution&amp;quot;&amp;gt;{{Cite conference |url=http://www.forth.com/resources/evolution/index.html |title=The Evolution of Forth |author=C. H. Moore |author2=E. D. Rather |author3=D. R. Colburn |conference=ACM SIGPLAN History of Programming Languages |book-title=ACM SIGPLAN Notices |volume=28 |number=3 |date=March 1993 |access-date=2021-04-04 |archive-date=2011-08-22 |archive-url=https://www.webcitation.org/6184coen2?url=http://www.forth.com/resources/evolution/index.html }}&amp;lt;/ref&amp;gt;，允许使用者很容易組合系統已有的簡單指令，定义成為功能较复杂的高階指令。由於其結構精簡、執行快速、操作方便，廣為當代天文學界使用&amp;lt;ref name=&amp;quot;oSWRm&amp;quot;&amp;gt;[https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/ NASA applications of Forth] (original NASA server no longer running, copy from archive.org)&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;C4Oss&amp;quot;&amp;gt;{{Cite web | url=http://forth.gsfc.nasa.gov/ | title=Space Related Applications of Forth | access-date=2007-09-04 | archive-url=https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/ | archive-date=2010-10-24}}&amp;lt;/ref&amp;gt;。八十年代以後，有愛用者成立Forth Interest Group在世界各地推廣，並陸續在各类计算机上建立Forth系統及標準的语言。&lt;br /&gt;
&lt;br /&gt;
==简介==&lt;br /&gt;
Forth以可延伸的词典为核心，采用以[[堆栈]]为基础的高度[[模块化]]结构，是一种将[[解译器]]和[[编译器]]合并运用的双态系统。使用FORTH，可在[[编译]]过程中检测差错，并且逐步扩充编译程序代码。利用標準Forth所写的程序几乎不必大修改，就能在各类计算机运作；甚至在特別设计的电脑上可以完全放棄组合语言，直接由Forth转化成机器语言，就好像现代的[[Java虚拟机]]。同时，使用者也可以把自己定义的运算功能加入编译器中，使Forth语言更有弹性。&lt;br /&gt;
&lt;br /&gt;
Forth是一种可扩展的，交互式的语言。亦适用於小型的嵌入式电脑，现在它几乎可以在任何主流的芯片上解译和编译，甚至已有多種可直接运行Forth指令的芯片。在电子-{表格}-，专家系统，多用户数据库，和分布式实时控制系统中有广泛的应用。表面来看，Forth是一种基于堆栈的概念机。例如要计算（3+4）*5，程序就是：3 4 + 5 *。首先把3和4入堆栈，然后调用+子程序，把堆栈的最顶上两个元素取出（也就是3和4）进行加法运算，然后把结果入堆栈，然后把5入堆栈，然后调用*子程序，把最顶的2个元素，也就是7和5取出，并进行乘法运算，然后把结果入堆栈，最后的。把结果从堆栈中取出列印。事实上这是一种最简单有效的概念机。当然Forth远远不止这些。&lt;br /&gt;
&lt;br /&gt;
最常用在[[内建程序]]，以及[[系统与过程控制]]，它也用在[[微电脑]]上。主要运用在[[数据搜集]]与处理、[[图形处理]]、[[专家系统]]，以及[[实时流程控制]]等。&lt;br /&gt;
&lt;br /&gt;
== 样例程序 ==&lt;br /&gt;
下面是一个在标准输出设备上输出[[Hello World程序|Hello World]]的简单程序，这种程序通常作为开始学习编程语言时的第一个程序： &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;forth&amp;quot;&amp;gt;&lt;br /&gt;
: run-hello \定义一个单词，名字叫run-hello&lt;br /&gt;
  .&amp;quot; Hello, world!&amp;quot; CR ;&lt;br /&gt;
run-hello&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
只有在编译模式，也就是在定义一个单词的中使用.&amp;quot;指令，才能输出字符串。&lt;br /&gt;
&lt;br /&gt;
== 从程序员的角度看Forth ==&lt;br /&gt;
&lt;br /&gt;
用Forth的“追随者”的话来说{{谁}}，Forth是一种“人机一体”的语言。在程序员的意识中必须要有一台逻辑上的机器（可能是实际的芯片，也可能是虚拟机）。这台机器拥有两个堆栈（数据堆栈和返回堆栈），一个词典（在Forth中的词（word）对应于高级语言的函数或者子程序，若干的词构成词典。）一个内部解释器和一个外部解释器。&lt;br /&gt;
&lt;br /&gt;
和Forth语言一样，也是基于[[堆栈]]的[[程序设计语言]]还有[[PostScript]]。基于堆栈的工具还有linux下的计算器[[dc (程序)|dc]]，在其内部是通过堆栈实现的。&lt;br /&gt;
&lt;br /&gt;
使用Forth开发应用程序与使用其他语言开发应用程序的感受有很大的不同。Forth的一切都是透明的，使用者可以看到每一个功能的实现原理和过程，正是由于这一点，Forth可以作为学习操作系统及编程的非常好的工具。关于Forth编程的特点有一个较为贴切的描述：&amp;quot;如果C语言给你的感觉是：它是最好的程序设计语言，那么使用Forth给你的感觉则是：自己是最好的程序设计师。”{{Original research inline}}&lt;br /&gt;
&lt;br /&gt;
== 实现==&lt;br /&gt;
在微軟的windows操作系统下，一個很好的Forth系統是Win32Forth。詳見win32forth&amp;lt;ref&amp;gt;[http://win32forth.sourceforge.net]{{Wayback|url=http://win32forth.sourceforge.net/|date=20200829045313}}&amp;lt;/ref&amp;gt; 。&lt;br /&gt;
&lt;br /&gt;
GNU/Linux系列操作系统下，GForth是GNU對[[ANS Forth]]的一個實現，可在gnu网站&amp;lt;ref&amp;gt;[ftp://ftp.gnu.org/gnu/gforth/]{{Wayback|url=ftp://ftp.gnu.org/gnu/gforth/|date=20120628164248}}&amp;lt;/ref&amp;gt;下载（另有HTTP链接&amp;lt;ref&amp;gt;[http://ftp.gnu.org/gnu/gforth/ HTTP链接]{{Wayback|url=http://ftp.gnu.org/gnu/gforth/ |date=20140903122017 }}&amp;lt;/ref&amp;gt;，GNU软件一般推荐通过镜像站点&amp;lt;ref&amp;gt;[http://www.gnu.org/prep/ftp.html 镜像站点]{{Wayback|url=http://www.gnu.org/prep/ftp.html |date=20140826050102 }}&amp;lt;/ref&amp;gt;下载）。下載後，使用通常的&amp;lt;code&amp;gt;configure; make; make install&amp;lt;/code&amp;gt;指令即可編譯安裝。GForth還可以內置在著名的文本編輯器[[Emacs]]中使用。若出现问题，请阅读&amp;lt;code&amp;gt;BUILD-FROM-SCRATCH&amp;lt;/code&amp;gt;文件。&lt;br /&gt;
&lt;br /&gt;
GForth同时适用于其他系统，例如[[OS X]]等UNIX类系统。&lt;br /&gt;
&lt;br /&gt;
==引用==&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
== 外部連結 ==&lt;br /&gt;
*[http://www.forth.org/ FIG]{{Wayback|url=http://www.forth.org/ |date=20110716163549 }}，Forth兴趣小组，是致力于教育和推广Forth编程语言的一个全球性的非盈利组织。&lt;br /&gt;
*[http://www.forth.com/ Forth公司主页]{{Wayback|url=http://www.forth.com/ |date=20110721151250 }}，上面有很多经典的Forth学习资料，历史和教程。&lt;br /&gt;
*[https://web.archive.org/web/20060906065605/http://forth.3322.org/ 中国Forth程序员]，Forth程序员社区和资料站。&lt;br /&gt;
*[http://www.forth.com/starting-forth/ Starting Forth]{{Wayback|url=http://www.forth.com/starting-forth/ |date=20120611153744 }}，[[Leo Brodie]]写的Forth语言的入门教材，该书的特色是使用大量生动的图片来说明程序执行的流程。&lt;br /&gt;
{{程序设计语言|Forth}}&lt;br /&gt;
&lt;br /&gt;
[[Category:程序設計語言]]&lt;br /&gt;
[[Category:面向堆栈编程语言]]&lt;br /&gt;
[[Category:1970年建立的程式語言]]&lt;/div&gt;</summary>
		<author><name>imported&gt;ExultantEditor</name></author>
	</entry>
</feed>