Author Topic: is anybody using the Forth language ?  (Read 6286 times)

0 Members and 1 Guest are viewing this topic.

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
is anybody using the Forth language ?
« on: September 10, 2013, 04:16:44 pm »
if so, could you explain me the advantages ?
it was said that it could help you to rapid prototype about robotic stuff, i wandering why.

Also, could you suggest
- a pretty implementation of Forth in C
- a pretty book/doc that could train about "thinking in Forth"
- a pretty example of usage in real life
 

Offline Balaur

  • Supporter
  • ****
  • Posts: 525
  • Country: fr
Re: is anybody using the Forth language ?
« Reply #1 on: September 10, 2013, 08:53:43 pm »
Heh, that brings back some memories.

I've dabbled in Forth on my Sinclair Spectrum. I didn't have any reasons that I was young, curious about everything and there was no Internet to sink my time and attention.

I was very happy with Forth at the time: fast, efficient and modular. I was able to seamlessly extend the interpreter with new words, run times were much nicer than equivalent Basic programs; even RPN seemed natural in that context.

Why use Forth now? I honestly have no idea. There is a plethora of information on net; pick one. There are nice interpreters available: gforth, win32forth, ...

Best regards,
Dan
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: is anybody using the Forth language ?
« Reply #2 on: September 10, 2013, 10:12:19 pm »
wandering if i can put a forth implementation on 68HC11, i have only 32Kbyte of ram.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: is anybody using the Forth language ?
« Reply #3 on: September 10, 2013, 10:17:50 pm »
it seems possible, here
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: is anybody using the Forth language ?
« Reply #4 on: September 10, 2013, 11:06:32 pm »
Matrix uses forth on a Z80 to control their entire strippers. (strippers are machines that remove the photoresist from silicon wafers by exposing them to an oxygen plasma. ) the robot controller driving the wafer handler had a forth interpreter.
you could hook up a simple terminal hit ctrl-c and type forth commands on the command prompt to control the machine.

Forth is RPN . it is stack based. you push stuff on the stack and then pop it off as it is executing. weird language,
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline grenert

  • Frequent Contributor
  • **
  • Posts: 448
Re: is anybody using the Forth language ?
« Reply #5 on: September 11, 2013, 02:26:42 am »
"Starting Forth" by Leo Brodie is considered a classic text in learning FORTH.  However, it's very old and I don't know how applicable it is to modern FORTH.  On the positive side, it is available for free online:
http://www.forth.com/starting-forth/

I've always wanted to learn FORTH because after 30 years of HP RPN calculators, the stack is really intuitive to me.  However, I have not been able to figure out how to get around the lack of floating point arithmetic (may be present in some versions of the language, but traditional FORTH was apparently integer only).
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3383
  • Country: us
Re: is anybody using the Forth language ?
« Reply #6 on: September 11, 2013, 02:50:23 am »
if so, could you explain me the advantages ?

It's self compiling, and includes an interpreter.

Nowadays you can easily get good compilers for small CPUs, and compile time is a non-issue.  So, it no longer has any real advantages.

The big disadvantage is that it tends to be write-only... often, not even the author of a Forth program can understand it.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: is anybody using the Forth language ?
« Reply #7 on: September 11, 2013, 05:52:18 am »
Quote
could you explain me the advantages ?
Forth occupies a sort of "sweet spot" between interpreted languages and compile languages.  Usually a forth implementation is faster and smaller than most compilers, while retaining the interactive aspects of an interpreter (not ALL interpreters stress interactivity these days.  but Forth does; you can type commands and get them to work immediately.  I once wrapped a Forth superstructure around a Fortran graphics library, just so I could quickly try out the various "interesting" graphics calls.)

Quote
it was said that it could help you to rapid prototype about robotic stuff, i wandering why.
Probably the availability of that interactivity.  You can write a Forth "word" so you can do things like "100 forward stepmotor", and then use it either interactively, or in a bigger Forth program.

Quote
a pretty implementation of Forth in C
Forth is designed to be implemented on top of a pretty bare machine.  A C implementation is not likely to be "pretty."  (some assembly language versions are extremely elegant.  Not all.  It surely helps if you can easily implement TWO stacks, for instance.)   There ARE C versions...

Quote
a pretty book/doc that could train about "thinking in Forth"
Brodie's book.
IMO, Forth's biggest weakness is that it didn't catch on to this whole "filesystem" thing that started happening to microcomputers.  You go along figuring things out and it's all pretty cool till you get to this archaic disk stuff based on reading raw disk blocks.  Perhaps newer forth has something better.

Quote
a pretty example of usage in real life
IIRC, The SUN Rom monitor/bootstrap is written in forth.  Also, Postscript is very forth-like.
As someone said, Forth isn't very pretty to READ.

By all means check out http://www.forth.org/

Quote
can I put a forth implementation on 68HC11, i have only 32Kbyte of ram.
Almost for sure.  32k is a large system by forth standards.  "amforth" for the AVR is about 8k of flash, 200 bytes of RAM, and 100 bytes of EEPROM for its core, for instance.
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7547
  • Country: 00
  • +++ ATH1
Re: is anybody using the Forth language ?
« Reply #8 on: September 11, 2013, 06:00:41 am »
The big disadvantage is that it tends to be write-only... often, not even the author of a Forth program can understand it.

Don't know bout Forth, but geez.. really ?  I find this statement funny.  :-DD

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: is anybody using the Forth language ?
« Reply #9 on: September 11, 2013, 06:47:17 am »
Quote
really [write-only] ?
Well, super-efficient interpreted language from the pre-disk era.  Comments take up space!  Meaningful keyword names take up space!  So... Yeah.  I assume it  COULD be better now (and I've seen/written well commented postscript programs, so...)

Not as bad as other languages from the same era.  APL took similar "limitations" and added a whole new character set (with overstrikes!)  TECO was, well, indistinguishable from line noise.
 

Offline JuKu

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: fi
    • LitePlacer - The Low Cost DIY Pick and Place Machine
Re: is anybody using the Forth language ?
« Reply #10 on: September 11, 2013, 07:07:41 am »
Re: is anybody using the Forth language? Yes, but not anymore. Some years back, I did work to a networked multiprocessor system based on Forth.
if so, could you explain me the advantages ?
Sorry, I can't. There is none. Forty years ago, when the development stations did not have disks and there were no compilers (assembler was hand-compiled) it was great. But in real life (and I've been there!), we now have compilers. By my experience, Forth is significantly less productive than any other language I know of, assembler included.
« Last Edit: September 11, 2013, 02:26:35 pm by JuKu »
http://www.liteplacer.com - The Low Cost DIY Pick and Place Machine
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: is anybody using the Forth language ?
« Reply #11 on: September 11, 2013, 04:26:19 pm »
"Starting FORTH", good resource  ;D
 

Offline Crazy Ape

  • Regular Contributor
  • *
  • Posts: 181
Re: is anybody using the Forth language ?
« Reply #12 on: September 12, 2013, 03:31:02 am »
An online FORTH interpreter.
http://forthfreak.net/jsforth80x25.html
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: is anybody using the Forth language ?
« Reply #13 on: September 12, 2013, 06:01:25 am »
The big disadvantage is that it tends to be write-only... often, not even the author of a Forth program can understand it.

Don't know bout Forth, but geez.. really ?  I find this statement funny.  :-DD

The moment someone pulls the trick on you to have code in some Forth application to modify the way the compiler works from inside while compiling, you really need to sit down, exclude distractions, say :wtf: a few times, have a stiff drink (but only one) and start to think hard to understand what is happening. At least if you don't do Forth daily for at least 20 years.

But that is not really the most annoying part. The annoying part is that "they" always try to sell you Forth as a cult, a philosophy, a religion. If you read the 30 year old publications of the FIG or old books about Forth, and there isn't much new material available, it is always about "everyone else does it wrong, tomorrow Forth will concur the world, go with the program or you will be extinct". I didn't like that then, I don't like it today. Imminent world domination since decades ... And it always comes with stupid stuff like "tho shall have no real editor", "tho shall have no real file system" "tho shall not use variables".
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: is anybody using the Forth language ?
« Reply #14 on: September 12, 2013, 06:20:23 am »
Quote
Forth as a cult, a philosophy, a religion.
Wow.  I frequently disagree with things that "Bored" says, but that's a fine statement of the things that always felt wrong about Forth.  Implement it, play with it, use it where appropriate.  But don't become a zealot...
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: is anybody using the Forth language ?
« Reply #15 on: September 12, 2013, 08:12:49 pm »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: is anybody using the Forth language ?
« Reply #16 on: September 13, 2013, 12:58:53 am »
I also liked the articles by Richard Fritzson in Feb/Mar 1981 issues of Kilobaud Microcomputing Magizne.
At least, that what I painfully transcribed into my homebrew assembler and tried to run on my homebrew 8085 simulator.  IIRC, it didn't quite work, leading to an epiphany about the failings of having too many unproven steps on the way to a single goal.

(I guess the 8085 simulator basically worked.  It (slightly) later inspired/became a commercial CP/M simulator.  Not from me, though.  (another interesting lesson.))


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf