Live data from Hacker News

Starting Forth

forth.com

51–60 of 71 posts

Re: Starting Forth

#51
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.

Forth have, literally, "taken off" far further than pretty much anything else. Many spacecraft in our Solar system are run by forth, the most notable recent example being Philae: https://en.wikipedia.org/wiki/RTX2010

Re: Starting Forth

#52
post #2

" Starting Forth " is recommended reading, and so is " Thinking Forth " which was posted a few days ago: https://news.ycombinator.com/item?id=9842557

I tried reading "Thinking Forth", but never got why it is praised so much. Looks like a bunch of war stories from 80s from veterans who discovered some basics of encapsulation in need to handle Forth programs complexity.

Re: Starting Forth

#53
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)

Some people use them (or a sibling) in space http://www.cpushack.com/2014/11/12/here-comes-philae-powered...

I guess dead simple design, low consumption is attractive here.

Re: Starting Forth

#54

Those who enjoy Forth may also like to try PostScript for a more graphical experience.

I liked programming in PostScript more than Forth because of all the additional non-graphic things it had. Look at the Blue Book ("The PostScript® Language Tutorial and Cookbook") http://partners.adobe.com/public/developer/ps/sdk/sample/ind... for some examples.

Re: Starting Forth

#55

Those who enjoy Forth may also like to try PostScript for a more graphical experience.

I liked programming in PostScript more than Forth because of all the additional non-graphic things it had. Look at the Blue Book ("The PostScript® Language Tutorial and Cookbook") http://partners.adobe.com/public/developer/ps/sdk/sample/ind... for some examples.

Many years ago I did a project with a lisp back-end, a front end in PostScript (NeWS/HyperNeWS) and C code gluing the two together - it made me appreciate than an interactive PostScript environment is surprisingly lisp-like.

Edit: This has made me wonder about a NeWS-like server sitting on top of OpenGL and using an interactive PostScript like language.....

Re: Starting Forth

#56
Is there any resource for learning how to implement Forth? It would be really cool to have a book that showed you how to determine your machine's capabilities and gave example of how you could implement it from scratch starting on Windows, Mac, Linux and onto other systems like Raspberry Pi, TI calculators and than how it is implemented on more esoteric systems like satellites.

Re: Starting Forth

#57
post #56

Is there any resource for learning how to implement Forth? It would be really cool to have a book that showed you how to determine your machine's capabilities and gave example of how you could implement it from scratch starting on Windows, Mac, Linux and onto other systems like Raspberry Pi, TI calculators and than how it is implemented on more esoteric systems like satellites.

it doesn't go into specifically exploiting your machine but the infamous Jones Forth is ~1000 lines of assembly and ~a billion lines of comment explaining the assembly and this gets you into a functioning Forth, then it starts writing everything else in forth, including IF, WHILE, DO UNTIL... which shows how you can use the parsing words to write new language features.

https://rwmj.wordpress.com/2010/08/07/jonesforth-git-reposit...

Re: Starting Forth

#58
Question for the Forth folks in this thread. Does Forth support loadable code modules?

Here's the problem I'm trying to solve (still in the tinkering stage). I have an embedded processor with small on-board SRAM but huge external address space and a NAND flash. Can't add external RAM. http://www.atmel.com/tools/ATSAM4S-XPRO.aspx

Would like to be able to run more code than can fit in the SRAM. With C, I was looking at the old style overlays. https://en.wikipedia.org/wiki/Overlay_%28programming%29

Also want to be able to support downloadable code modules.

Was looking into a Tcl dialect http://wiki.tcl.tk/1363 but I keep thinking Forth would be perfect.

Re: Starting Forth

#59
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.)

How does K&R C allow more minimalist programming?

Re: Starting Forth

#60

Question for the Forth folks in this thread. Does Forth support loadable code modules? Here's the problem I'm trying to solve (still in the tinkering stage). I have an embedded processor with small on-board SRAM but huge external address space and a NAND flash. Can't add external RAM. http://www.atmel.com/tools/ATSAM4S-XPRO.aspx Would like to be able to run more code than can fit in the SRAM. With C, I was looking at…

I can imagine implementing a direct threaded Forth, but instead of code addresses being memory locations, code addresses are a virtual address; DOCOL and NEXT swap in the appropriate segment of code into memory where necessary.

This could possibly be optimised in a subroutine threaded Forth so code within each "page" wouldn't have to verify loaded segments.

Implementing a dictionary insertion/optimization routine that packs related routines together to minimise swapping would be an interesting problem, and would probably most easily not be done live but ahead-of-time instead.

In short: Yes, Forth can support the paging you desire if implemented that way.

Post reply on HN