Another Forth remark
Funnyly i stumbled across this: One of the original aims of Forth was to erase the boundary between user and programmer - to give all possible power to anyone who had occasion to use a computer. Nothing in the above labeling or remarks should be construed to mean that this goal has been abandoned. at http://www.taygeta.com/forth/dpansa15.htm (end of the first paragraph) Seems to be commonplace amongst language inventors ;-) Maybe they're all on a mission... Dipl.Inform. Dirk-Ulrich Heise hei@adtranzsig.de dheise@debitel.net
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). 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. Then it would be up to you to pass this data to methods for execution, in order to come up with a printed result. So from a Python prompt it might look something like this:
import forth forth.start()
Welcome to Pseudo-FORTH -- a Python project
1 1 + 2 2 3 * 6
Or whatever it is. Is that the kind of thing you're doing? Short of this, I think there's a way of using Python to "give the flavor" of another language. This is what I was doing with Scheme -- not implementing Scheme in Python (not even trying), put using the two syntaxes in parallel to highlight similarities and differences. Typically, when Scheme and C and placed side by side, or Scheme and BASIC, you're showing how _different_ they are (emphasis on "contrast" vs. "compare"), but in the case of Python, you maybe want to bring the _similarities_ into the foreground. I did study FORTH from a book a long time ago but I don't think I ever had a CLI to play with (memory hazy). In any case, I've pretty much forgotten whatever I learned. 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". Like you say (or implied, by sharing that quote giving the hopes of the FORTH folks), these languages come and go. If we want Python to stick around, we'll have to develop a bigger user base, and, to me, that means gain more exposure for it in K-12. But not as an end in itself (not Python for the sake of Python), but as a means to an end (making programming languages more accessible in general, with Python providing an easy on-ramp, and quick access to a lot of the central ideas in an interactive environment -- thereby serving as a stepping stone to other languages _in addition_ to being a productive real world language in its own right). So my hope is that some Java folks, for example, won't necessarily say "no no, you shouldn't be doing Python in middle school, you should be doing Java!" More, a lot of them will be saying "Java is pretty hard and middle school is probably too early to dive into it deeply -- but Python has a lot in common with Java, so we support middle schools adopting that, knowing in the long run this will produce a stream of Java programmers as well." I think some Schemers (not all), might have the same attitude. Kirby
-----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
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)
OK, I'll give that a try. Sounds like fun.
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?
I'll have to poke around -- just a dim recollection, could have been in a book vs. part of the Standard Library.
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
FORTH sounds like a very fun language (I recall enjoying reading about it). I like the idea of introducing prefix and postfix notation in the same lesson plan. Plus I'm all for expanding on the concept of "data structures" in K-12 [1] and FORTH provides a great opportunity to talk about the stack structure. Kirby [1] http://www.inetarena.com/~pdx4d/ocn/trends2000.html
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?
Turns out I was thinking of the cmd module. Kirby
participants (2)
-
Dirk-Ulrich Heise
-
Kirby Urner