Live data from Hacker News

Starting Forth

forth.com

41–50 of 71 posts

Re: Starting Forth

#41
post #40

An approachable platform for hacking Forth is the OLPC laptop[1]. For about $25 USD[2], that's a pretty cheap way to go Forth and multiply :-). 1 - http://www.openfirmware.info/Forth/FCode 2 - http://www.ebay.com/sch/items/?_nkw=olpc+laptop&_sacat=&_ex_...

If you have an OLPC XO 1 then you can also download the specifications for the AMD CPU here: http://www.versalogic.com/support/Downloads/PDF/LXManualMay0... That tells you how to do graphics hacks and so on. I had fun with that on my OLPC. I optimized the Forth console to scroll using hardware BLIT (much faster than CPU copy of the framebuffer) and I ported Squeak Smalltalk to run directly on OFW using hardware graph…

The biggest hack I did was to rewrite the builtin PONG game to try and be more in the spirit of Thinking Forth: http://lukego.livejournal.com/10847.html

Re: Starting Forth

#43

There was a Forth debug/service terminal included in an electronic typewriter / typing tutor device from the 80's with an integrated CRT display. So an educated guess is that its software was also written in Forth. It was made between 1981 and 1987 and I think it was a golf ball-style printer, so if anyone have an idea as to the make and model, that would be great.

I'm guessing you're thinking of the Canon Cat. There was also a plugin board version for an Apple //e which went in the 80 column slot.

Re: Starting Forth

#44
post #25

Earlier quoted context omitted.

What has the industry moved onto now?

Embedded stuff is nearly always C. Arduino have made the "Wiring" language popular for rapid prototyping (based on processing and hence javascript). But these days, embedded full Linux systems are just too cheap to not be the default option when you want to develop on the device itself.

For the smaller stuff (automation) PLCs are also quite popular, especially for the EE guys.

Re: Starting Forth

#45
post #27

Forth seems to have one thing in common with Lisp: a small dedicated following that believe it's the way forward and considerably easier to learn, despite never really having taken off. I suspect this is something to do with different ways of conceptualising programs.

I haven't written a Forth program that I didn't write better and faster than the equivalent in C. But writing it in Forth was so much more fun. I think that's where part of the followers dedication comes from. Forth is like making jewelery, C is like laying bricks.

Jewelers don't build skyscrapers.

A friend of mine who programmed solely in Forth (and who taught me just about everything I know about the language) quipped that 'C is such a great language'. That was his way of saying he considered C to be bloated compared to Forth.

Re: Starting Forth

#47
post #3

It's really cool to see all of this interest in Forth. I think when I learned Forth, it made me a significantly better developer over all; it's also an awesome base for DSLs and really a fascinating paradigm.

Yup, me too. I'd recommend that anyone with a serious interest in programming should learn Forth (and write a Forth system from scratch): I'll probably never use it in anger, but it made me think about programming in a very different way.

(Also, curiously, gave me an increased respect for K&R C, which allows minimalist programming in a way that ANSI C doesn't.)

Re: Starting Forth

#48

Earlier quoted context omitted.

Sorry, I'm wrong regarding OSX and iOS. OpenFirmware is used at numerous places, but Apple is not one of them.

Apple used it when they were still PowerPC-based. They sadly dropped it with the move to Intel.

You used to be able to boot up with Command+O+F and get a Forth prompt. (Although I have a hazy recollection that on some models they didn't include a screen terminal, so you couldn't interact with it...)

Re: Starting Forth

#49
post #9
post #3

It's really cool to see all of this interest in Forth. I think when I learned Forth, it made me a significantly better developer over all; it's also an awesome base for DSLs and really a fascinating paradigm.

Honest question, wouldn't you just write a lexer with yacc/bison for a DSL? How does a full programming language act as a base for a DSL, which is usually more limited than a programming language?

The kernel for FORTH is crazy small. IIRC it's not unusual to shoe horn it into 2K. When people talk about writing DSLs in FORTH, I think what they are really saying is writing an API based on the FORTH kernel. So the DSL is really FORTH, but just with your API. Granted changing how words are compiled and executed is pretty much standard fare for a FORTH programmer, so you can make it work however you want.

FORTH is a bit like smalltalk in that you usually work in an interactive environment and save images. FORTH code compiles down to essentially a jump table and so it is also really, really efficient, space wise. You can decompile code easily and modify it in your image.

If you were trying to write a control language for some small embedded device, it would be ideal. If you were trying to write a DSL for configuring a build system (or something like that) it would be less nice ;-)

My first few paying jobs (when I was in university) was writing FORTH code, but that's a very long time ago ;-) I'm still quite nostalgic about it even though I've forgotten almost everythng I once knew.

Re: Starting Forth

#50
post #42

And here is what Forth creator Chuck Moore does today: http://www.greenarraychips.com/

Asking the obvious question: What should I use that for? (The computer, and Forth too)

Its power consumption is ridiculously low; IIRC, at full utilization, it can be powered by a solar panel the size of your hand.
Post reply on HN