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
163 views

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
64 views

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
512 views

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
561 views

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
43 views

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.4k
6 votes
1 answer
240 views

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.4k
16 votes
3 answers
2k views

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
1k views

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.4k
6 votes
1 answer
401 views

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