Forth like interpreter

Kragen Sitaker kragen at dnaco.net
Sat Mar 11 23:44:57 EST 2000


In article <158801bf8bdc$08516040$6401a8c0 at dorb>,
Darrell <darrell at dorb.com> wrote:
>Wrote a Forth like interpreter in Python.
>Probably useless but it gave me something to do today.
>http://www.dorb.com/darrell/forth/forth.py

This is awesome!

>Kragen Sitaker mentioned in "What if Python Replaced Elisp" that Forth
>compilers were easy. He's right!

It was only hearsay!  I have the F83 source but have never understood
it :)

>I only did one branching instruction "if" and an assortment of other words.
>
>The compile phase could generate Python byte code or for real crazies
>assembler. Real Forth often comes with an assembler built in. So I can see
>how some version of Lisp might compile to assembler.

Traditionally, Forth includes a vocabulary that lets you assemble stuff
on the fly.  Execution of a word in the assembler vocabulary either set
up a parameter (e.g. source register) or appended an instruction to the
currently-being-built routine.
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either.  :)



More information about the Python-list mailing list