Live data from Hacker News

Implementing a Forth

ratfactor.com

11–20 of 70 posts

Re: Implementing a Forth

#15

I went down the "make your own Forth" rabbit hole about 45 years ago. In January 1979, Byte Magazine's Language Forum contained the article, "IPS, An Unorthodox High Level Language."[1] The article described IPS, a language based on Forth, but with the word names translated to German. Thus, Forth's SWAP became VERT, short for vertauschen. The intriguing article concluded with a reference to Charles Moore's 1974 paper…

Wow! What an amazing story! I started writing forth few months ago, wrote few interpreters, with jit or with types etc, and its just amazing, I think anyone should do it. TBH I don't think any other exercise has thought me as much about programming as this. I also notice the "return" of Forth, as it is probably the easiest high level language to make for computers with addressable memory and fetch execute cycle. The…

Howerj has a really easy subleq/muxleq interpreter. Eforth under Muxleq runs fast enough (perfectly usable) under an ATOM n270. Subleq too, but Muxleq it's must faster.

Re: Implementing a Forth

#16
post #6
post #5

Earlier quoted context omitted.

What kind of programs would one naturally reach for Forth as the optimal solution? It has always struck me as a very low level language but I rarely hear this caveat from its advocates.

I highly doubt it's useful these days on general purpose computers, where even the very smallest ones can easily implement C (or better) or even run a whole operating system like Zephyr or Yocto. However if you're creating your own computer from scratch or have other artificial constraints (like it needs to fit into a boot sector[1]), and if you want to really understand precisely how your language works down to the…

Arduino's, ESP32 based minicomputers, TRS100 like handheld computers...

Re: Implementing a Forth

#17
post #10
post #5

Earlier quoted context omitted.

What kind of programs would one naturally reach for Forth as the optimal solution? It has always struck me as a very low level language but I rarely hear this caveat from its advocates.

It made more sense in the 8 bit home computer era, where you could do a more high level coding with more performance than a BASIC interpreter, without having to mess with hexdumps for DATA segments, or Assembly opcodes.

And specifically this is because compiled Forth uses a simple kind of compression. (This is explained a bit better in jonesforth).

Re: Implementing a Forth

#18
post #7

I am under impression that more people implement Forth than use it for programming...

It's a great exercise as a programmer to implement a language, Forths and Lisps are popular choices.

It greatly helps conceptualizing computation and what's truly essential at it's core.

Re: Implementing a Forth

#19
post #7

I am under impression that more people implement Forth than use it for programming...

we used FORTH extensively in the bring-up of the Atari ST. it was easy for the hardware engineers to come up with little fragments of FORTH so they could exercise their chips without needing much support from the software team

FORTHs are fun to write. they'll teach you a lot about ruthless simplicity

i don't think FORTH is useful for large programs, but that's not the point of the language

Re: Implementing a Forth

#20
My first interpreters were Forth-derivatives, it's a great way to start designing your own languages.

I've recently been working on a project to lower the barrier to entry for budding language designers. The language is strictly prefix, but could easily be turned into postfix with minor changes.

https://github.com/codr7/shi

Post reply on HN