Forth

From Esolang
(Redirected from FORTH)
Jump to navigation Jump to search
This article deals with Forth as it relates to esoteric programming. For more general information, see the Wikipedia article on Forth.

Forth is a stack-based language invented by Charles H. Moore in the 1970s. Although designed for hardware control, interactive programming, and writing applications; it is itself somewhat esoteric compared to other mainstream languages. Its very simple syntax and operandless computational model allow it to have very compact implementations. It has inspired many other stack-based esoteric languages, such as FALSE and Befunge.

Many things from other programming languages (both esoteric and normal) could already be done in Forth a long time ago, such as making up your own control structures. Now there are many Forth standards and many Forth implementations which either follow the standards or don't follow the standards. Forth is a very powerful program language because whatever it is missing you can add it in by yourself!

colorForth

Chuck Moore went on to refine his own Forth programming environment, gaining inspiration from his own custom microprocessor designs. The result is colorForth, which looks even more esoteric than standard Forth. For more compact programs and to assist his failing eyesight, the language uses color to distinguish syntactic elements of the language. From his own web site (from the Wayback Machine; retrieved on 14 March 2016):

  • Stand-alone! Includes operating system.
  • Compact! 2K bytes for core software.
  • Fast! Optimized object code.
  • Simple! Applications stored as source. No object library.
  • Innovative! Text compressed and pre-parsed.
  • Unique! 27-key Dvorak keyboard.

Machine Forth

Chuck Moore also uses a pared down Forth for his custom minimal-instruction set processors. They are an inspiration for designing other minimal languages. For example, his latest designs have five-bit instructions, for 32 possible opcodes:

  • Stack: DROP, DUP, OVER, PUSH, POP
  • Math: +, AND, XOR, NOT, 2*, 2/, multiply-step
  • Call: JUMP, CALL, RETURN, IF, -IF
  • Loop: NEXT, UNEXT
  • Register: A, A!, B!
  • Memory: @, !, @+, !+, @B, !B, @P, !P
  • NO-OP: .

External resources