Has anyone implemented BASIC in Python?

Paul Rubin http
Mon Aug 23 11:30:08 CEST 2004


Peter Hansen <peter at engcorp.com> writes:
> > Dunno about Logo but I did Forth just out of general perversity.
> > I suppose I could post it.
> 
> Please do!

Well, it's not real Forth, just a mini-subset that I threw together in
a few hours, to get some understanding of how Forth is supposed to
work.  But you can type stuff like

  : square dup * ;
  3 square .

and it will print 9 at you.  Part of the perversity is that each word
is compiled to a Python lambda and is invoked by calling the lambda.
The idea was to make both Pythonistas and Forthwrights(?) scream in
disgust ;-).  Please forgive the lack of comments etc.  I wasn't going
to release it (at least in that condition), but you asked for it ;-).

http://www.nightsong.com/phr/python/forth.py



More information about the Python-list mailing list