5 ms·
Starting Forth - After yesterday's Prolog post, another awesome language
- iuguy 16y agoI thought after yesterday's Prolog post went down quite well I'd try introducing those of HN who haven't experienced it to Forth, a stack-based language that I loved as a child for it's extensibility (given at the time my alternative was BASIC or Z80 ASM I hope you'd understand). Older Mac users might not know this but your Open Boot firmware contains a fairly reasonable Forth interpreter built in. Anyway, I hope you enjoy Forth as much as I did. EDIT: Brain fart, wrote stackless when I meant to write stack based, sorry.
- mtm 16y agoI love Forth but it's anything but 'stackless'. In fact, it's probably one of the most stack intensive languages to ever exist (and one of the funnest, especially when used for embedded systems work). 'Starting Forth' is indeed a treasure, I think I'll dig out my old copy and add it to the stack, heh.
- iuguy 16y agoThanks for pointing out my brainfart, I've edited it. As a thankyou, here's the Forth I used as a kid: http://www.worldofspectrum.org/infoseekid.cgi?id=0008178 http://www.worldofspectrum.org/infoseekid.cgi?id=0008178 ISTR it was a FIG-Forth implementation, but I haven't used it in over 20 years (wow, that feels old) so I might be wrong.
- mtm 16y agoNo sweat. I remember using Apple Forth (from Cap'n Software) in 1982 in Independent Study in high school. I made a cloud chamber simulator with it for the Physics department. (Side note: my public high school had an awesome science department: a radiation class complete with scintillation counters, a cobalt source in a lead pig, etc. PDP-11 and Apple IIs, small radio telescope on the roof. Riverview High School, Sarasota, FL; no idea what it's like these days.)
- iuguy 16y agoWow, I spent two years looking after a PDP 11/23 running RTS/E. Interesting times... In that I've never met anyone less than 20 years older that understands what I've done (and to be fair most of those older than that have an aamazing understanding compared to me), I found it amazing that between the PDP and AS/400 box at work that they were bought by people that retired a long time ago and still ran, not that the data coming out was accurate. I think the rest of my employer's place was like that, and perhaps that was part of the problem.
- kenjackson 16y agoI always wanted to learn Forth, as there was a Forth compiler available on the Commodore Vic-20. Thanks for the reminder and the link. :-)
- iuguy 16y agoIt wasn't this by any chance? http://www.zimmers.net/anonftp/pub/cbm/vic20/roms/tools/8k/Vic%20Forth%201.10.prg http://www.zimmers.net/anonftp/pub/cbm/vic20/roms/tools/8k/V... You should be able to load this into VICE (http://www.viceteam.org/ http://www.viceteam.org/) and start hacking away. Hope this helps.
- kenjackson 16y agoHonestly, I don't remember. I never used it. I just used to see it in Compute! magazine. But this looks cool. Never had seen VICE before either.
- zandorg 16y agoI got an Oxford Computer Publishing FORTH compiler for my Commodore 64. A great language, though I only tried to write a text adventure in it!
- colomon 16y agoI wrote a SID music sequencing program in Forth on my C64, it was a tremendously fun programming environment. (I think there may have been a bit of assembler involved as well, as it was very easy to call from Forth.)
- fogus 16y agoHere is a simple Forth implementation in Ruby. https://github.com/fogus/rforth https://github.com/fogus/rforth
- pdelgallego 16y agoJust for those that are interested in lear how to implement a forth compiler or even just a compiler, this [1] is a step by step tutorial on how forth is implemented. The tutorial is a extremely well commented code file that you can run. [1] http://www.annexia.org/_file/jonesforth.s.txt http://www.annexia.org/_file/jonesforth.s.txt
- spc476 16y agoFor a real mind blowing experience, you should also read _Thinking Forth_ (http://thinking-forth.sourceforge.net/ http://thinking-forth.sourceforge.net/) also by the same author. It was one of two books that radically changed how I write programs (the other one being _Writing Solid Code_).
- jallmann 16y agohttp://chargen.matasano.com/chargen/2009/1/10/applicable-lessons-from-the-embedded-world-aka-forth-rules.html http://chargen.matasano.com/chargen/2009/1/10/applicable-les... Some crazy stuff that you could do with Forth. The author shows how you can inject a forth VM in shellcode and build exploits on top of that.
- primodemus 16y agoMinimal FORTH compiler and tutorial : http://www.annexia.org/forth http://www.annexia.org/forth Lambda the Ultimate thread: http://lambda-the-ultimate.org/node/2452 http://lambda-the-ultimate.org/node/2452
- maximilianburke 16y agoJones Forth is awesome because it isn't just a great way to learn Forth but also a great way to learn assembly programming. A couple years ago I did a rather crude, hurried, and unoptimized port of Jones Forth to the Cell processor's vector units. Initially I intended it to be an April Fool's gag for my group at work but I came away with a much better knowledge of the underlying architecture.
- hvs 16y agoForth is among the languages that every developer should learn, even if they never use it in a production environment. It will definitely make you think a little differently. It's as if lisp and assembly language had a child. On another note, it is REALLY easy to write completely incomprehensible spaghetti code in Forth. You really have to be disciplined or you'll end up with a lot of "write-once" code.
- ctdonath 16y ago"yesterday's Prolog post" Link for those of us not following HN 24/7?
- spicyj 16y agohttp://news.ycombinator.com/item?id=1976127 http://news.ycombinator.com/item?id=1976127
- misterm 16y agoIs anyone still using this in a production environment? I don't think I've ever seen a language like this one before.
- silentbicycle 16y agoFreeBSD's boot loader uses a dialect of forth. Forth makes MUCH more sense in an embedded context, IMHO.
- VladRussian 16y ago>Forth makes MUCH more sense in an embedded context, IMHO. Forth is just unbeatable in an embedded context. Minimal porting of a few basic words and you're up and running with fully functional environment you can adjust on-the-fly.
- wnoise 16y agoDo you consider boot ROMs production environments? http://en.wikipedia.org/wiki/Open_Firmware http://en.wikipedia.org/wiki/Open_Firmware
- coliveira 16y agoFor people using windows, an excellent free Forth is win32forth.sourceforge.net. One can even write graphical apps with it.
- dugmartin 16y agoIf Forth intrigues you check out Factor: http://factorcode.org/ http://factorcode.org/
- wwortiz 16y agoThe only thing factor is missing is a book/tutorial/better example docs. The current documentation is top notch though and you can learn a lot if you look through the factor blogs (or read a forth book) Link to factor blogs: http://planet.factorcode.org/ http://planet.factorcode.org/
- andybak 16y agoI learnt Forth as a kid. (http://www.worldofspectrum.org/infoseekid.cgi?id=0008967 http://www.worldofspectrum.org/infoseekid.cgi?id=0008967 plus Acorn Forth) What blew my mind was that - apart from a tiny kernel - Forth was written in Forth. It bootstrapped itself from basic principles. It's kind of the Principia Mathematica of programming languages...