Better HN
topnewbestaskshowjobs
Log inSign up

obijohn

4 karma · joined Sep 27, 2024 (2y ago) · 2 submissions

Submissions

comment 1y ago · link · parent

The last time I tried helix it was still pretty rough around the edges, so I can’t comment too much about the content of the post. But I will say that this is a beautifully designed blog and very pleasant on the eyes. I can count on one hand the number of times I’ve thought that in the past year. I love it when someone shows this much care in the presentation of their ideas.

comment 1y ago · link · parent

I was thinking about this reading the article. In fact, I’ve recently seen Lisp implemented in Forth[0] and Forth implemented in Lisp[1]. In both cases, the implementations are decently complete and surprisingly efficient (i.e. not “toy” interpreters).

I think this is due to a significant property shared by both languages: the parser’s primary role is distinguishing between numbers and anything that’s not a number. No need to worry about operator precedence, keywords, or building complex syntax trees. Tokens are numbers and “not-numbers”, and that’s it.

In Forth, a “not-number” is a Word, and in Lisp a Symbol, both of which can be variables or functions. The only difference between the two is that Forth checks for Word definitions first, and Lisp checks for numbers first. If you wanted to redefine 4 to 5 for some reason, Forth’s got your back, but Lisp will save you ;).

A Forth Dictionary is very similar to a Lisp Environment; they both serve as a lookup table for definitions, and they both allow the programmer (or program!) to redefine words/symbols.

They also both have REPLs to facilitate a much more dynamic development cycle than other REPLs in most languages.

I could go on, but on a fundamental level the similarities are striking (at least to me, anyway). It’s an interesting rabbit hole to explore, with lots of “drink me” bottles laying around. It’s fun here.

[0] https://git.sr.ht/~vdupras/duskos/tree/master/item/fs/doc/co...

[1] https://github.com/gmpalter/cl-forth