Saturday, 20 March 2010

Threaded Interpretive Languages by R. G. Loeliger

Threaded Interpretive Languages by R. G. Loeliger
In Threaded Interpretive Languages, Loeliger explores the design and implementation of TILs in an individual quirky style.  Programs in a threaded language typically compiles to a list of subroutine calls or addresses. Loeliger focuses on Forth-like threaded languages and provides examples in Z80 assembly language.

After the standard introductory chapter the book gets straight down to the implementation details, first dealing with the design of the dictionary format, inner and outer interpreters.  This is followed by example code for the interpreters and assembly language definitions for 170 of the most common subroutines.

Later chapters investigate some common extensions to TILs including virtual memory and floating point numbers. A section is devoted to assemblers and includes code for a structured Z80 assembler.

Threaded Interpretive Languages contains the most in-depth examination of Forth internals I've seen. However the age of the books shows in the dialect of Forth used and the systems described. Despite this, I'd still recommend Threaded Interpretive Languages to anyone planning to implement a minimal Forth.

12 comments:

  1. I was about to ask you exactly this question: I'd still recommend Threaded Interpretive Languages to anyone planning to implement a minimal Forth.

    Thus... I'll have to add it to my Amazon shopping list :)

    ReplyDelete
  2. Rubén, there's some material online which has been helpful while implementing my own Forth:

    Moving Forth by Brad Rodriguez
    Jones Forth by Richard Jones
    eForth x86 by Bill Muench

    If you'd prefer a book, Threaded Interpretive Languages is the best I've found even though it's 30 years old.

    ReplyDelete
  3. It was a few days since I last checked your blog! Thanks for the links. I have already printed Jones Forth (although it is quite "heavy"), will take a look at the other two, then. But it was a month since I last wrote a line of Forth! Ajj! My raytracer is not going well :/

    ReplyDelete
  4. That last link of John's should probably have been "eForth x86 by Bill Muench".

    I actually have a copy of Loeliger's book, which I bought new many years ago to help me implement a project that management insisted be done in IBM 360 assembler and/or Cobol even though it needed something higher level. As a work around, I researched high level things I could set up in those, and found Forth; then I basically wrote it in Forth on top of IBM 360 assembler, with a separate Cobol module for the I/O, using assembler macros rather than a text interpreter and Forth source so that technically I stayed within the permitted environment (it would have gone quicker if I had been allowed the more interactive Forth environment, though - I wouldn't have needed an editor etc. but just a text interpreter, since I could have piped source into it from a PC file). It was a triumph of misguided ingenuity, since the whole project was clearly worthless from the beginning anyway (it was meant to deskill the use of another package, but installing it in an IBM mainframe environment meant that the users would need to learn something just as awkward to get it in the first place).

    ReplyDelete
  5. Isn't that cover image the same as that of the Forth issue of BYTE?

    ReplyDelete
  6. Jonathan O'Connor7 April 2010 at 01:51

    Moioci, it sure was used in BYTE. But I can't remember if the language issue was in February or April or August each year.

    ReplyDelete
  7. Peter, thanks for pointing out the broken link. Projects like the one you mention are the reason I've never pursued a programming career. I just couldn't find the motivation for something pointless.

    Moioci, Jonathan, I'm not surprise to hear the cover was used in BYTE. Loeliger's introduction mentions he wrote to BYTE offering an article and they asked for a book :-)

    ReplyDelete
  8. Here's a link to it by ISBN


    http://www.google.co.uk/search?q=ISBN-10+007038360X

    One of my favourite computer texts, I have my copy :)

    ReplyDelete
  9. Learning and programming in Forth is the fastest way to test a hardware idea!

    ReplyDelete
  10. I agree this is a great book. It helped me implement many a FORTH system. colorForth and greenarrays chips anyone?

    ReplyDelete
  11. The world has moved on to Machine Forth.

    ReplyDelete
  12. There are two scanned versions preserved: http://sinclairql.speccy.org/archivo/docs/books/Threaded_interpretive_languages.pdf and http://mirrors.acm.jhu.edu/textfiles/bitsaved/Books/Loeliger_threadedInterpLang.pdf.

    ReplyDelete