[Edu-sig] Another Forth remark

Dirk-Ulrich Heise hei@adtranzsig.de
Fri, 13 Oct 2000 10:24:02 +0200


-----Ursprüngliche Nachricht-----
Von: "Kirby Urner" <pdx4d@teleport.com>
>
> I haven't studied your source in detail at this point, but do
> have a question.
>
> My idea of what it'd mean to actually implement a part of FORTH
> in Python would be to provide a command line in which users
> could enter legal FORTH syntax (without modifications), and
> get the expected output.  My understanding (I could be wrong),
> is FORTH is similar to Python in defining a CLI (command line
> interface) or REPL (read, execute, print loop).

Very simplistic approach to that: (paste this into my script)

def shell():
  """
    a simple interactive shell
  """
  print "Forth command line. Type 'quit'<RET> to quit."
  while 1:
    print ">",
    x = raw_input()
    if x=="quit":
      break
    execute(x)


>
> As I recall, Python actually ships with a class designed to
> provide a user prompt.  You could subclass this, and a parser,
> which automatically analyzes user input into tokens somehow.

Don't know - which class do you mean?

> My friend Ron was writing a book on FORTH and one point,
> and I think even a compiler, but so far as I know, that
> whole project reached a dead end, perhaps because FORTH
> stopped being so "hot".

When he was able to write a book about Forth, he
*surely* also wrote a Forth compiler... There's not much
of a difference between "programming in FORTH"
and "modify it's compiler".

Dipl.Inform. Dirk-Ulrich Heise
hei@adtranzsig.de
dheise@debitel.net