cwpjr@cbnewse.att.com (clyde.w.jr.phillips) (04/18/91)
From: yoshi@nocusuhs.nnmc.navy.mil (Dojun Yoshikami) Newsgroups: comp.robotics Subject: Re: "Easy" way to put "AI" in realtime embedded systems? Message-ID: <1991Apr17.143949.25843@nocusuhs.nnmc.navy.mil> Date: 17 Apr 91 14:39:49 GMT References: <5495@mindlink.UUCP> <1991Apr16.155126.5186@sagpd1> Organization: National Naval Medical Center Lines: 117 In article <1991Apr16.155126.5186@sagpd1> monty@sagpd1.UUCP (Monty Saine) writes: > > I may be totally wrong in this but aren't FORTH and LISP close relatives? >It seems to me that FORTH was the foundation of LISP. Now as I said before >I may be remembering wrong or have the wrong "child" of FORTH in mind, or I >may just be remembering a LISP that was developed from FORTH as an exercise >by some one I knew or read about. Is there anyone out there that can set me >straight or re-enforce this?? > >Thanks, > >Monty Saine Ho boy, here we go. Don't feel bad, FORTH and LISP are quite different. The first difference is FORTH is Postfix and LISP is prefix. The Second is FORTH allows one to bind at any time (using the words : CREATE and DOES>) either early or late (which is why it's so d*mn fast!) whereas LISP (for the most part) tends to be late binding and does not allow one to control binding as easily. FORTH is easily extensible, for instance, FORTH doesn't have a GOTO but if you want it, you can program it in. (Now how many languages can you do that in? Yes, Virginia, there are places where you want GOTO's, particularly where state transitions are concerned). Forth allows you to extend your language to create your own defining words. The main defining word : (pronounced Colon) which you use to define other words is defined in Forth. In Forth you can De-compile definitions to see what they are, run non-preemptive multitasking, and have assembly code assembled right in front of your eyes, fully integrated with Forth code. Forth happily works with Assembler (it's very very easy) and many Forths have a built in assembler (for particularly tight code). FORTH makes a terrific microprocessor architecture (you can make one within 4000 gates) which runs at blinding speeds. Indeed, a 4mhz Novix ran 8088 code using a 8088 simulator faster than an 8088 at a slightly higher speed (6mhz, I believe). A FORTH chip can run 100-1000 times faster than a 80386 running at twice the clock speed. Why? Someone once told me that FORTH makes a terrific microcode language. A bit of trivia: some time ago, there was a survey asking compiler writers what kind of machine they'd like to write for. They wanted a stack based machine which turned out to be unusually close to the Forth machine. It seems that stack based machines are a lot better than register based machines for traversing DAGs. From the very beginning FORTH has had multi-tasking (some FORTH systems omit it, in particular, FIG-forth) which is something most languages don't have. (Ada has NOTHING NEW, and besides, FORTH's multi-tasking algorithm (non-premptive) is geared for real-time multi-tasking). FORTH and LISP developed quite separately. Forth has one word called ' (pronounced TICK) which I believe was descended from LISP's single quote. But other than that, the architecture and thought processes between the two are completely separate. In fact, ' (tick) works completely differently. You can write a LISP interpreter in FORTH, but you'd be rather hard pressed to write a FORTH interperter in LISP. The term FORTH INTERPETER is actually a bit misleading, FORTH will interpret, compile, or (in many cases) assemble depending on what you want. Assemble code at run time? No problem! Compile on the fly during run time? No problem! Forth encourages you to figure out how the innards work and fiddle with the insides and extend it and change it as you wish. How many other languages do this? C certainly doesn't! (Ever try to extend a C compiler? It's not that easy. You can learn the innards of forth and fiddle with it within a week or two). Forth is easily ROM-mable within 1-2k for a bare bones interpreter (a good choice for those robotic things which wander around) and you can buy FORTH chips off the shelf (From Silicon Composers, or Harris semiconductor). It is practially the EASIEST language for controlling hardware. Now for the problems. Forth is not standardized, indeed there are many dialects out there (FIG, Forth-79, Forth-83, PolyForth, etc.) Many FORTH's didn't have floating point numbers (fix point integer math is usually faster), there is a big need for libraries (for databases, windowing, data structres, whatnot) that other languages (such as C) already have. True, you can create these functions in Forth, but who has the time? Another problem is most people don't understand Forth, which really is so different than anything else, you have to re-think some things. Also FORTH does not have all those nice syntax-analysis and software development tools that C has now days (things like YACC and LEX, source code analyzers, &c) Finally, FORTH leaves a LOT in the programmer's hands that could be standardized; for instance, data abstraction and encapsulation are easily accomplished, but since those are not standard, everone has his own way of doing it. (I don't mind standardization, as long as they continue to allow everyone to fiddle under the hood when necessary). Too much in the FORTH world is non-standard. ANSI standardization is a good idea, I just hope they don't hose things too badly. Anyways, to answer your question (finally) Forth is about as related to Lisp as the Metro-Goldwyn Lion is related to Calvin Cooledge. Sure, they're both mammals, both are male, but there the resemblences stop. Both Forth and Lisp are Programming languages, they can run on the same machines, but I wouldn't substitute one for the other. (Can you imagine a Lion in the Oval Office and a President in a cage? Hey! I heard that!!!! No comments from the Peanut Gallery!!) If you're wondering why I'm so interested in Forth, currently I'm in the process of making a few small microprocessor controlled robotics projects, and the easiest way to program them is in Forth. If there's anyone who knows where to get a ROM-able Z80 Interpreter, Let me know (I'm too lazy to write my own!) May the Forth be with you!!!!!! FORTH LOVE IF HONK THEN DY =-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= D M Yoshikami :-) ;-) :-) | Internet: yoshikami@usuhsb.ucc.usuhs.nnmc.navy.mil May the Forth be with you! | Bitnet : yoshikami@usuhsb.bitnet *** !!xob X*NU V METSYS T&TA eht ni renosirp dleh gnieb m`I !pleH !pleH *** =-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= P.s. I program in practically any language I can get my hands on, including Ada, C, and, on rare occasions (!) COBOL (arrgh!). I figure, each language has some reason for existing, so I try to exploit that, especially if the language is tailored to a certain problem. I will not write windowy SQL databasey things in Forth, just like I would REFUSE to write small rommable hardware control (robotics) projects in RPG. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#--#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-##-Not even the smart cookies know how they will crumble - Wisom of the Cookies#- #-Clyde W. Phillips Jr. FORTH plan Amiga Man Dead Fan Chicago Born GO BULLS!!!-##-South Shore Hyde Park NewTown Wicker Park Rogers Park Evanston I BEEN AROUND-##-Reach out to me at clyde@ihlpl.att.com or (708) 713-5365w or (708) 386-3147h-##-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#--#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
cwpjr@cbnewse.att.com (clyde.w.jr.phillips) (04/18/91)
In article <1991Apr17.184925.29@cbnewse.att.com>, cwpjr@cbnewse.att.com (clyde.w.jr.phillips) writes: > From: yoshi@nocusuhs.nnmc.navy.mil (Dojun Yoshikami) > Newsgroups: comp.robotics > Subject: Re: "Easy" way to put "AI" in realtime embedded systems? > Message-ID: <1991Apr17.143949.25843@nocusuhs.nnmc.navy.mil> > Date: 17 Apr 91 14:39:49 GMT > References: <5495@mindlink.UUCP> <1991Apr16.155126.5186@sagpd1> > Organization: National Naval Medical Center > Lines: 117 Lot's o neat stuff deleted... > If you're wondering why I'm so interested in Forth, currently I'm in the > process of making a few small microprocessor controlled robotics projects, > and the easiest way to program them is in Forth. If there's anyone who knows > where to get a ROM-able Z80 Interpreter, Let me know (I'm too lazy to write > my own!) > > May the Forth be with you!!!!!! FORTH LOVE IF HONK THEN > > DY Hi there! I've done a LOT of this. I ported a FIG-FORTH for my buddies Z-80 SBC back in 1980. By 1984 he employed it in a Naval Contract implementing Spread Spectrum Battlefield relay radios, or was it remote data acq. radio relays, anyway the Naval Officers LOVED IT. His interactive remote diagnostics didn't hurt either. So anyway this man is Mike Simon, (815) 874-2296 Space-Time Productions Talk to him as he currently controls our 8-bit products, and you guys may have more to talk about.... Clyde