CompC

WHY?
Login

WHY?!?

I have always been interested in forth. I was at a SVFIG group meet up at Stanford. Dr. Ting was handing out copies of his excellently written document entitled "eForth and Zen". I was intrigued, the virtual machine seemed simple enough. Most of the code for the entire system was written in forth. This got me thinking, what would be required to write a program that could implement enough of a subset of eforth to generate an image that was self hosting on a virtual machine. I gave myself a few constraints, minimal function calls, use as little of c as possible and treating c as portable assembler. The result fits in under 500 lines of C. It can read in an eforth source file and generate an image that can run on a very simple VM with 21 opcodes.