← 返回命令列表

Linux command

forth 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start Forth interpreter (Gforth)

gforth

Run Forth script

gforth [script.fs]

Evaluate expression

gforth -e "[1 2 + .] [bye]"

Include file then go interactive

gforth [script.fs] -

说明

Forth is a stack-based programming language known for its simplicity and extensibility. Gforth is the GNU implementation of Forth, conforming to the ANS Forth standard. Forth uses reverse Polish notation (RPN) with an explicit stack. Words (functions) are defined with `:` and `;`. The language is highly interactive and extensible, commonly used in embedded systems.

参数

-e _code_
Evaluate Forth code.
-m _size_
Dictionary size.
-d _size_
Data stack size.
-r _size_
Return stack size.
-
Read from stdin.

FAQ

What is the forth command used for?

Forth is a stack-based programming language known for its simplicity and extensibility. Gforth is the GNU implementation of Forth, conforming to the ANS Forth standard. Forth uses reverse Polish notation (RPN) with an explicit stack. Words (functions) are defined with `:` and `;`. The language is highly interactive and extensible, commonly used in embedded systems.

How do I run a basic forth example?

Run `gforth` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -e _code_ do in forth?

Evaluate Forth code.