Questions tagged [forth]

Forth is a dynamic, procedural, stack based programming language developed by Charles Moore.

Forth is a dynamic, procedural, stack based programming language developed by Charles Moore in 1968. It uses what is commonly referred to as reverse Polish notation; also called Postfix notation.

Forth is a language often used in embedded settings, due to the small size of many interpreters, as well as its low memory footprint. As an oft-compiled language, it is also used for writing low-level software such as OpenBoot.

Various implementations exist today, including:

  • Gforth - The GNU Project's official implementation
  • Various products from the original company, FORTH Inc.
  • pforth - A portable Forth written in ANSI C
  • ... and more recommended by the FORTH Interest Group.

Finally, this is Forth's Hello World program (other examples available from Wikipedia):

CR .( Hello, world!)

Books and Resources

279 questions
43
votes
8 answers

What are the primitive Forth operators?

I'm interested in implementing a Forth system, just so I can get some experience building a simple VM and runtime. When starting in Forth, one typically learns about the stack and its operators (DROP, DUP, SWAP, etc.) first, so it's natural to think…
Barry Brown
  • 20,233
  • 15
  • 69
  • 105
36
votes
5 answers

Examples of very concise Forth applications?

In this talk, Chuck Moore (the creator of Forth) makes some very bold, sweeping claims, such as: "Every application that I have seen that I didn't code has ten times as much code in it as it needs" "About a thousand instructions seems about right…
Alex D
  • 29,755
  • 7
  • 80
  • 126
30
votes
13 answers

Is Forth still in use? If so, how and where?

A long time ago I remember thinking that the Forth programming language was pretty cool. I really haven't heard anything about it in years. Is Forth still in use? If so, what types of applications is it being used for?
Rick Ross
  • 373
  • 1
  • 3
  • 6
27
votes
7 answers

Which Forth to start porting from?

I'm looking to develop a new Forth system, aimed at making game development easier on one or possibly several retro console platforms. I'm something of a Forth beginner, and need your help deciding which Forth codebase to start porting from. I'm…
Tyr
  • 782
  • 8
  • 19
22
votes
9 answers

What implementation of Forth should I use for learning Forth?

I want to start learning Forth (like in the related Stack Overflow question Is it practical to learn and use Forth?). I see that there are many implementations. I would like to use a ANS 1994 compatible version (if reasonable, but sticking to the…
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79
20
votes
8 answers

Real world usage of concatenative programming languages

What are some real-world projects done in concatenative languages like Forth, Factor, Joy, etc.?
Vijay Mathew
  • 26,737
  • 4
  • 62
  • 93
16
votes
3 answers

Comparison of Common Lisp macros and Forth metaprogramming capabilities

Every Common Lisp programmer knows that macros are a powerful tool. Common Lisp macros have been used, among other things, to add object orientation on top of Lisp without changing the language specification; read-macros are another construct with…
user3750103
  • 193
  • 1
  • 5
15
votes
7 answers

Memory management in Forth

So I'm just learning Forth and was curious if anyone could help me understand how memory management generally works. At the moment I only have (some) experience with the C stack-vs-heap paradigm. From what I understand, one can allocate in the…
J Cooper
  • 16,891
  • 12
  • 65
  • 110
14
votes
12 answers

What programming languages have the most easily-implemented interpreters?

I need to implement an interpreter for a programming language as part of a project I'm working on. I don't think the details of this project are too relevant, except that it requires me to implement an interpreter from scratch, I can't use an…
sanity
  • 35,347
  • 40
  • 135
  • 226
13
votes
1 answer

(GNU) Forth Local Variable Behavior

I was just learning about local variables for word definitions in Forth. I happen to use GNU Forth (gforth). I was looking at the question and answer, Forth local variable assigning variables and was struggling with the behavior of the given answer.…
lurker
  • 56,987
  • 9
  • 69
  • 103
13
votes
2 answers

Logical AND in Forth?

I know the AND word defines binary and... but what defines logical and?
Johan Kotlinski
  • 25,185
  • 9
  • 78
  • 101
13
votes
3 answers

What is the most common filename extension of a Forth source code file?

I have seen people save Forth source code files with the extensions .4th, .fth, .frt and .f. Which is the most common filename extension of Forth source code files?
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
12
votes
4 answers

How do I design and implement a programming language?

This question is related to This question on Aardvark This question on here The past couple of years I've been thinking about things I like and don't like about languages I use. I always wanted to write my own language, but never did so. I also…
Pepijn
  • 4,145
  • 5
  • 36
  • 64
11
votes
2 answers

How does Forth implement the dictionary? (controversy)

I am studying Forth for a personal project I have on my mind. It looks to be a really cool and simple language to implement in a small virtual machine. I am especially impressed by the possibilities of the use of vocabularies on it. On the other…
11
votes
1 answer

6502 lightweight compression algorithms

I'm implementing virtual memory on dual cassette tape decks on a Commodore PET (for fun) for a Forth I'm writing. What I have so far is at http://github.com/chitselb/pettil if you're interested. I'm planning to use the PET's native 192-byte…
chitselb
  • 153
  • 5
1
2 3
18 19