Let's build a forth compiler
Mike Huselton
Posts: 746
I just read a blog entry from James Hague concerning a well done approach to compiler design.
home.iae.nl/users/mhx/crenshaw/tiny.html
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Jack W. Crenshaw wrote the Let's Build a Compiler article series from 1988 - 1995. This document is a formatted version of that excellent non-technical introduction to compiler construction. These web pages were created in 2005, and port Mr. Crenshaw's original Pascal code for the 68000 under SK*OS to the Forth language on a 80x86 CPU, under Windows XP. said...
home.iae.nl/users/mhx/crenshaw/tiny.html
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Comments
Have you made any progress?
Though this paper seems to be a bizarre graft by a unscrupulous Forth toad trying promote Forth under Crenshaw's name.
I'd skip it and check out Camel Forth by Brad Rodriguez instead if you want to build a Forth implementation from scratch or even E-Forth.
From time to time over the years I have looked into the famous Dragon book hoping to glean something about compilers and each time found it totally inscrutable and given up. BUT after working through Crenshaw I now go back to the Dragon and find some parts of it have a light shone on them. For example the first 50 or so pages of the Dragon book talk about analysing source into "parse trees" or "syntax trees". All of which seems too heavy for a hobby project. But at he end of all that section is the statement that for many cases none of that is necessary at all !!. Which of course was the approach demonstrated so elegantly by Crenshaw.
waltc: I have to say that "unscrupulous Forth toad" might be a bit uncalled for. After all the guy does title his version as "A tribute to this great article series by Jack W. Crenshaw.." and Jack himself did encourage people to build on his work for example by inviting us to implement code generators for Intel processors.
As it happens a couple of months ago I worked through Crenshaws papers creating my own versions of his code in C. The end result was a compiler for his TINY language into Propeller LMM (Lage Memory Model) Assembler which can be assembled and run via Propasm. If anyone is interested I could dig that out and post it here. I tried to make it as simple and direct as Jacks original code.
I hope that would not make me an "Unscrupulous Propeller toad"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson
"It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter
www.iElectronicDesigns.com
"After all, it’s nice to have a small, simple compiler, but it would be of little use if the resulting language were cryptic and hard to program. The language FORTH comes to mind (a premature OUCH! for the barrage I know that one’s going to fetch me)."
By the way who created that PDF?. It would be nice if they could fix up some of the formatting bugs were the text has been formatted as code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.