Live data from Hacker News

Forth: The programming language that writes itself: The Web Page

ratfactor.com

21–30 of 89 posts

Re: Forth: The programming language that writes itself: The Web Page

#21

Related Chuck Moore talk: "Programming a 144 Computer Chip to Minimize Power" (2013) https://www.youtube.com/watch?v=0PclgBd6_Zs How Forth powers ultra-low power computers: "GreenArrays is shipping its 144-core asynchronous chip that needs little energy (7 pJ/inst). Idle cores use no power (100 nW). Active ones (4 mW) run fast (666 Mips), then wait for communication (idle)."

I genuinely wonder if this topology won't make a come back in the coming years.

To me GA144 looks less like a state-of-the-art CPU or DSP replacement and more like an FPGA replacement—and that would actually be lovely to see, given how inefficient and expensive FPGAs are nowadays compared to doing the same thing with a custom chip (if you only overlook the design cost for the latter). The “computer” marketing makes little sense to me.

Unfortunately, GA don’t seem to have gotten the memo about cheap entry-level dev tools that the microcontroller world has been circulating since 2010 or so. At the prices they charge for their devboards, you wouldn’t really get one just to play with, even if the chips themselves are actually somewhat cheap compared to getting the same amount of compute on an FPGA.

(It’s $500 per devboard and $20 per chip, with each chip capable of 2e9 16-bit multiplies/sec. Somebody[1] is selling a breakout board with only the chip for a much more reasonable price of $35, but you’ll need to figure out how to wire up the thing yourself.)

Charles Moore is known for aggressively patenting his hardware, though. (Well, he and every other modern chip designer.) So we might not get to see anybody else do this stuff for a long, long time. Adapteva’s Epiphany/Parallella design used a broadly similar idea with an explicit grid interconnect and also aimed for a piece of the FPGA/ASIC pie, but they had much beefier, synchronous cores with separate message routers attached to them.

[1] https://schmartboard.com/schmartboard-ez-qfn-88-pins-0-4mm-p...

Re: Forth: The programming language that writes itself: The Web Page

#22

I have implemented yet another forth by myself. It works a little bit different and it is not intended to be a true copy of the original idea. Since the post says you can discover Forth, here's my part: https://github.com/loscoala/goforth The main difference is that in this Forth variant, the source text is completely translated into bytecode and there is no runtime in the sense of classic Forth. This makes it easy t…

That can be very productive and clever, but be - and stay - aware that such polyglot solutions tend to be maintenance headaches in the longer run.

There is a really nice open source project out there that allows you to train your hearing and your sightreading, but it's written in the authors own language which in turn compiles to JavaScript and the headache to set up their toolchain is such that I haven't bothered fixing any of the bugs that I'm aware of (and there are plenty).

https://sightreading.training/

https://github.com/leafo/sightreading.training

It's written in a language called 'Moonscript':

https://github.com/leafo/moonscript

Which compiles to Lua. Which compiles to JS.

Madness. Nice madness, but still, it stopped me from being a contributor.

Re: Forth: The programming language that writes itself: The Web Page

#23
post #6

Ah, what beautiful paradigms there are which we toil away without. Retro (a modern Forth) looks very interesting. The textbook Thinking Forth is near SICP in terms of opening your mind to a new paradigm. Is anyone using Forth in production these days with stories to tell?

Probably not. It turns out that it doesn't map to modern computer processors terribly well. It's an amazing and elegant language, but anything that does register-to-register operations is always going to be faster than register-to-memory.

> Probably not.

Probably yes.

Re: Forth: The programming language that writes itself: The Web Page

#24

anecdata (and warning some people might not like that domain brought here), there's a mini vm in bitcoin that a subset of forth https://en.bitcoin.it/wiki/Script I just learned that this week

By that rule the JVM is a 'subset of FORTH'.

Re: Forth: The programming language that writes itself: The Web Page

#25

A great introduction is the book Starting Forth [0]. It has the most charming illustrations I've ever seen in a text book. [0] https://www.forth.com/starting-forth/

There is also Thinking Forth, which is a kind of sequel [0] https://www.dnd.utwente.nl/~tim/colorforth/Leo-Brodie/thinki...

https://thinking-forth.sourceforge.net/ <- A better source. The one you linked includes a number of typographical errors early on (OCR errors?) that were grating for me to try and read. None of the errors I noticed in your link were present in the copies I checked out here.

Re: Forth: The programming language that writes itself: The Web Page

#26

One of the most interesting Forth projects to me currently is Dusk OS, a 32-bit operating system written in Forth that includes its own C compiler, with various porting efforts under way https://duskos.org/

That is indeed interesting. THX for making me aware of it.

Re: Forth: The programming language that writes itself: The Web Page

#27

One of the most interesting Forth projects to me currently is Dusk OS, a 32-bit operating system written in Forth that includes its own C compiler, with various porting efforts under way https://duskos.org/

I missed this one. Thanks for the link. I was just reading "Beyond the Collapse" and my Lisp and APL/J and C skills would not allow me to approach Forth's simplicity at the OS level. I'll definitely check this out by next weekend.

Re: Forth: The programming language that writes itself: The Web Page

#28
post #6

Ah, what beautiful paradigms there are which we toil away without. Retro (a modern Forth) looks very interesting. The textbook Thinking Forth is near SICP in terms of opening your mind to a new paradigm. Is anyone using Forth in production these days with stories to tell?

I only wrote some file munging and reporting programs in Factor, a batteries-included Forth. Nobody would need these tools, so I was free to make and use for myself. They had people scraping HTML and Excel reports to do their reporting before. I exported my results to HTML and Excel. Sneaky fun for myself!

Re: Forth: The programming language that writes itself: The Web Page

#29
As soon as I met Forth, I felt I had to hack my own (https://github.com/ttsiodras/MiniForth/) - and did so over a single week, two years ago. I targeted the Blue Pill and the original Arduino, but developed via cross-compilers so that I could test my code in the host.

I became so obsessed with the project that I was looking forward to tinkering with it after coming back from work every day; so it was hacked in 5 evenings and a weekend. It was that much fun, to build a Forth.

I highly recommend the process; I think the only other time I felt so enlightened was when I first met Lisp macros (https://www.thanassis.space/score4.html#lisp).

Re: Forth: The programming language that writes itself: The Web Page

#30

Earlier quoted context omitted.

Stack code can be mapped to register code trivially if you impose some restrictions (each word has a static effect and both branches of a conditional have the same effect). Then lowering to SSA form performs an “abstract interpretation” where evaluating a word pops SSA values from a “abstract stack”, creates an SSA node and pushes its output values on the stack.

I wouldn't say that sounds trivial exactl... > slavapestov ... ok, fair enough: it probably is trivial for you, lol. (For the uninitiated: Slava Pestov created Factor, a modern concatenatvie language which (IIRC) did a lot of innovative stuff regarding optimizations in that domain) [0] https://factorcode.org/slava/

Ha!

Whenever I work on compiling Joy code I have to fight the urge to just write Joy-in-Factor and lean on all that crunchy goodness.

(I wrote Joypy (mentioned in TFA), now Thun (someone took Joypy on PyPI so I renamed it) which includes interpreters in C, Nim, OCaml, and Prolog. I made a few feints at compiling Joy so far, but it's just kid's play compared to Factor. "I am but an egg.")

Post reply on HN