Description edit
Forth consists of words (commands) that exchange parameters on a stack. This simple concept implies [postfix notation], and RPN in mathematical expressions.Chuck Moore created FORTH in 1970.Often over the years, FORTH and Tcl have been compared because of the mindset in both to write lots of procs/words to do one's work. There are quite some characteristics that are shared between the two languages:- reflection
- interactivity
- extensibility
- typeless (Forth) versus
dynamically typed (Tcl)
- ...
Postfix notation edit
Forth uses postfix notation (aka. Reverse Polish Notation), best-known from its use in HP calculators, and PostScript
1 2 + 3 * 4 / ( comments start with open paren and extend to close paren)Compare to Tcl (infix style):
expr {(1+2)*3)/4} ;# commentsor, if math operation commands are imported (prefix style):
/ [* [+ 1 2] 3] 4
See Also edit
- A different FORTH, by JBR
- Trying FORTH in Tcl, by jcw
- RPN in Tcl, by RS
- RPN again, by RS
- HP Calculator Simulations
- GPS RPN, by GPS
- HolonTForth, by wej
- TclForth, by wej
- 8th
- a secure, cross-platform Forth derivative
- toka
a concatenative programming language related to Forth
- tclzForth
- a tcl package for Windows based on zForth by Ico Doornekamp
Quotes edit
- "Forth seems to have too little syntax to be manageable"
- - KBK, Tcl Chatroom, 2013-12-26
Reading edit
- The A-Z of Programming Languages: Forth
, Naomi Hamilton, Computerworld, 2008-06-27
- Chuck Moore Holds Forth
, slashdot, 2001-09-14
- Why compilers are doomed
, jcw, November 2000
- Thinking Forth Tips
- Threads of a FORTH Tapestry
, Byte magazine, August 1980
- 1% the code, Chuck Moore
Tutorials edit
- A Brief Introduction to Forth
, by Philip J. Koopman Jr., 1993
- And so Forth
, J.L. Bezemer, 2001-04-25
- A primer
- Learn 4tH th easy way
- Starting Forth
, Leo Brodie, 1981 (alternate version of the same book [1])
- An introduction to Forth. A starkit version based on this book can be found here [2] (for Microsoft Windows/Linux/Solaris, requires package 'scripdoc').
- Thinking Forth
, Leo Brodie, 1984
- Thinking Forth captures the philosophy of the language to show users how to write more readable, better maintainable applications.
- JONESFORTH
, Richard WM Jones, 2009-09-11
- A sometimes minimal FORTH compiler and tutorial
Resources edit
- The Forth Interest Group
(FIG)
- The Forth Interest Group (FIG) was a world-wide, non-profit organization for education in and the promotion of the Forth computer language.
- Forth Wikipedia article
- The 4tH
compiler
- See also the historical site
- ForthOS
- a complete, standalone operating system for the PC (x86)
- Riscy Pygness
- Pygmy Forth for the ARM
- Ficl
- Ficl (Forth Inspired Command Language) is a programming language interpreter designed to be embedded into other systems as a command, macro, and development prototyping language.
- Gforth
- Gforth is the Forth implementation of the GNU project
- SP-Forth
- SP-Forth is an ANS forth system for Windows and Linux. It features optimized native code generation, high speed execution, full ANS'94 support, small yet highly-extensible kernel, big number of additional libraries for developing sophisticated windows applications, active and helpful community.
- pForth
- pForth - Portable Forth in 'C'
Several Forths have bound to Tk for their GUI toolkit needs. For example, amrFORTH V6


Zarutian 2006-09-24: Does an Tcl interpreter in Forth exists?Zarutian 2006-09-27: Or do I have to write one?wdb Please yes!Zarutian 2007-06-20: Hmm... that would require Forth words for:
- string manipulation (slicing and splicing)
- string comparison


ZB 2008-07-06: Every description of Forth focuses on using stack, RPN and so on - but I'm interested in such trivial things, like f.e.: is it possible to write Forth-programs with nice user interface (at least curses-based, if not Tk/GTK-like GUIs)? Any examples?Is event-based programming possible using Forth? A google-search for "event-based programming in forth" revealed nothing.tb 2008-07-07 - Yes, it should be possible by creating an event stack, holding addresses of handlers (as a first approach), but you'd have to program and enter your own event loop, because a classical FORTH inpterpreters loop only recognizes ONE input stream, which must be ASCII characters.escargo 2008-07-07: One of the original FORTH systems was a time-share system that supported 30 users on a 32K 16-bit word Honeywell H316 system. Every user got an input buffer and a private dictionary. A context switch between users required changing the value of 3 pointers (if I remember correctly). So if FORTH could do that, then using FORTH to create an event loop with "do one event" would seem to be possible.ZB: I was digging for more information meanwhile, and I've found, that Forth is something like "OS and set of tools for creation of one's own language" rather - and not "just another programming language". Looks very interesting. One can f.e. implement interrupts handlers.tb: Yes, this is called metaprogramming and in this aspect of creating your own problem-related language, FORTH is quite similar to Tcl. Instead of namespaces you have "vocabluaries" and instead of procedures you have "words". But, with the lack of a seamless integrated widget kit, like Tk in Tcl/Tk, FORTH will always only be a better assembler, heading for device drivers, document processors (Postscript) or other non-interactive tasks.PS: I remember a nice implementation of FORTH, running on Atari-ST under GEM. It managed windows, menus and events and fitted nicely into the Ataris OS. It was called "Volksforth




