Forth

This is the archived website of SI 413 from the Fall 2013 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Forth is a programming language that was designed with simplicity and ease of execution on resource-limited machines in mind. It was invented by Charles Moore for his own personal use in the 1960s, and subsequently became popular all over the world.

Forth is a stack-based language, which means that the environment keeps track of a big ol' stack which you are constantly pushing and popping to/from in order to get anything done. One advantage to this is the use of postfix notation and avoiding the need for parentheses; for example the program

5 6 7 + * .
loads the three numbers onto the stack, adds the top two (6+7), and then multiplies this by 5, then finally uses the . command to print out the result.

Useful Links

How I will run your code

The programs you submit should be in a single file called proj.fs. I will run your code on the CS Linux environment, using the command

gforth proj.fs

Be sure to issue the bye command at the end of your program!!