Skip to main content

Questions tagged [forth]

Forth is a stack-based programming language originally developed in the 1970s by Charles H. Moore for controlling radiotelescopes.

Filter by
Sorted by
Tagged with
4 votes
1 answer

Bubble Sort in Forth (for strings)

I wrote the following Forth code for sorting a string with the Bubble Sort method. It looks nice to my eyes, but I'd like your experienced opinion and any comments about the code you might have. In ...
pmg's user avatar
  • 520
3 votes
2 answers

Project Euler 8: find the maximum product of 13 consecutive digits

I'm doing Project Euler problems as a learning platform for Forth. Currently I'm solving Project Euler Problem 8 which involves a 1000-long string, which I entered directly in the source code. My ...
pmg's user avatar
  • 520
7 votes
2 answers

A simple clock in FORTH

I try to program a stopwatch/countdown clock in FORTH with Gforth (and using Gforth-specific words). I'm a complete beginner and the following code is the basic stuff (going to add an alarm function ...
viuser's user avatar
  • 195
6 votes
2 answers

Simple terminal graphics line drawing

The program starts at the center of the screen and starts drawing a line in 50ms steps. When the line hits the edge of the terminal it will be reflected and continue drawing. ...
SANK's user avatar
  • 73
2 votes
0 answers

Forth to the past - mergesort preps

Still oiling my Forth. Below are few essential algorithms for in-place merge. Please review. Some introductory comments: >swap< is not a cute smiley. I am ...
vnp's user avatar
  • 56.6k
6 votes
1 answer

Forth to the past - qsort

To make a long story short, I must revive my Forth. It is rusty; last time I did anything serious in Forth was 30 years ago (man, I am old). As an exercise, I translated an STL-like implementation of <...
vnp's user avatar
  • 56.6k
16 votes
3 answers

Reverse Polish notation based compiler

Description Very small subset of Forth This is a proof of concept level compiler, no optimizations or over/underflow checking See the embedded POD for more information NASM is used as assembler gcc ...
JaDogg's user avatar
  • 4,531
25 votes
2 answers

FizzBuzz in Forth

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! ...
Edward's user avatar
  • 66.5k
6 votes
1 answer

Toy Forth interpreter

I've been reading too many papers and writing too little code. These are my first 300 lines of Haskell: ...
Vincent Goossens's user avatar