Let's Build a Compiler - revamped



In 1988, the first installment of Jack W. Crenshaw's classic
"Let's Build a Compiler" article appeared. The last of this
16-part series was published in 1995.

I have started the conversion of Mr. Crenshaw's excellent
non-technical introduction to compiler construction into
Forth. That is, the original Turbo Pascal code for the 68000
under SK*OS is slowly getting transformed to Forth for a
80x86 CPU, running under Linux, Windows XP or MS-DOS.

The original text files can be downloaded from
http://compilers.iecc.com/crenshaw/. They are highly recommended.

At the moment, 10 of the 16 original articles are finished and
the HTML for the remaining 6 has been cleaned up. In the transcripts
a 32-bit, byte-addressing Forth with 8-bit characters is assumed.
Hopefully I am excused for using iForth, regrettably some work will be
needed for other Forths.

It is very tempting to completely rewrite the articles in Forth
style, but so far I have been able to resist. However, I do plan
to heavily modify the TINY language implementation that is used
Jack Crenshaw started, but apparently never finished completely.

I am only a few hairs removed from actually executing the compiled
code from within iForth (using the Forth assembler and Forth itself
as the RTL). It also seems very well possible to turn TINY into
an interpreter (by generating Forth instead of x86 code).

Maybe some people here would like to help with this project
(review & code suggestions). Given the popularity of the articles
it might be a nice Forth show-off to a broader audience.

I did not find any ports from the original 68K to x86 code, and
only one (unreadable) "C" project.

-marcel

.



Relevant Pages

  • Re: Is this good use of Properties?
    ... Overloads can also be inferred by the compiler ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... >I could declare it as static but only one instance of this class will ever ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is this good use of Properties?
    ... The C# compiler, unlike the brain-dead VB compiler, can figure out for ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... > public string URL ... > Also, if I only have a get accessor, is it necessary to declare the field ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Writing a compiler
    ... It's not a book but this serie of article may be helpful to you ... to understand how to build a compiler. ... > Read or write articles on just about anything ...
    (borland.public.delphi.non-technical)
  • Re: Conscious antipattern behavior
    ... Thanks, those are good articles. ... I wonder if one could implement a language that does to C++ what ... implemented as a C code emitter that a C compiler would then ...
    (comp.lang.cpp)
  • Re: SPY in your lottery
    ... It's going on 5 years now and Jack is still attempting to learn something ... about lotto. ... rec.gambling.lottery Griffuck/Gerry/Sherry/ has posted 1,119 articles. ... It's really good to see another turkey who "found" his own web ...
    (rec.gambling.lottery)

Loading