As I'm still so far behind in the LLM tech in terms of how it works, so I don't know what to think of this article, but my experience with using them as a user to generate FORTH code was often a failure. They just can't get it right, most likely due to lack of training data. OTOH, I also found writing FORTH as a human way more difficult than any other language I used, even more so than hand written assembly. But it amortizes itself fairly quickly, and things get a lot easier after a point (what I called earlier as vocabulary maturity). But more importantly writing FORTH code is way more fun and satisfying to me somehow.
FORTH? Really!?
21–27 of 27 posts
Re: FORTH? Really!?
#22https://github.com/howerj/subleq
https://github.com/howerj/muxleq
Muxleq because of performance:
cd muxleq
cc -O2 -ffast-math -o muxleq muxleq.c
Edit muxleq.fth, set these values like this: 1 constant opt.multi ( Add in large "pause" primitive )
1 constant opt.editor ( Add in Text Editor )
1 constant opt.info ( Add info printing function )
0 constant opt.generate-c ( Generate C code )
1 constant opt.better-see ( Replace 'see' with better version )
1 constant opt.control ( Add in more control structures )
0 constant opt.allocate ( Add in "allocate"/"free" )
1 constant opt.float ( Add in floating point code )
0 constant opt.glossary ( Add in "glossary" word )
1 constant opt.optimize ( Enable extra optimization )
1 constant opt.divmod ( Use "opDivMod" primitive )
0 constant opt.self ( self-interpreter [NOT WORKING] )
Then run:./muxleq ./muxleq.dec new.dec
new.dec it's the enhanced SUBLEQ EForth image.
To run it:
./muxleq new.dec
For the available words, run words
inside the interpreter.Enter
bye
to exit.Get Starting Forth but the ANS version (there's some PDF in search engines) and Thinking Forth.
Re: FORTH? Really!?
#23Earlier quoted context omitted.
Yep, given that implementing Forth is so easy (easier even than implementing Lisp) pretty soon nearly every Forth programmer decides to take their turn doing it themselves.
I suspect, for many, that implementing a forth is more interesting than using a forth. Once you start writing really complex programs the system gets painful and hard. But trivial things are easy, and the consistency is so appealing.
Creating the required primitives in Assembly, and then the remaining userspace out from them.
Afterwards it is programming like most languages.
I have done it with Lisps though.
Also on 8 bit home computers it provided the feeling to be coding close to Assembly while being close enough to BASIC as high level language.
Re: FORTH? Really!?
#24Looking to discuss with people about whether LLMs would do better if the language had properties similar to postfix-notation.
Re: FORTH? Really!?
#25Looking to discuss with people about whether LLMs would do better if the language had properties similar to postfix-notation.
I have just spent a month writing about 2000 lines of Forth. My answer is no, at least w/r to generating something that looks like the by-hand code I wrote. LLMs coast by on being able to reproduce idiomatic syntax and having other forms of tooling(type checkers, linters, unit tests, etc.) back them up. But Forth taken holistically is a do-anything-anytime imperative language, not just "concatenative" or "postfix". I…
Not exactly. Not only the stack is central in the design of Forth (see my comment over there [1]).
It seems to me that a point-free language like Forth would be highly problematic for an LLM, because it has to work with things that literally are not in the text. I suppose it has to make a lot of guesses to build a theory of the semantic of the words it can see.
Nearly every time the topic of Forth is discussed on HN, someone points out that the cognitive overload* of full point-free style is not viable.
Re: FORTH? Really!?
#26Earlier quoted context omitted.
I have just spent a month writing about 2000 lines of Forth. My answer is no, at least w/r to generating something that looks like the by-hand code I wrote. LLMs coast by on being able to reproduce idiomatic syntax and having other forms of tooling(type checkers, linters, unit tests, etc.) back them up. But Forth taken holistically is a do-anything-anytime imperative language, not just "concatenative" or "postfix". I…
> It has a stack but the stack is an implementation detail, not a robust abstraction. Not exactly. Not only the stack is central in the design of Forth (see my comment over there [1]). It seems to me that a point-free language like Forth would be highly problematic for an LLM, because it has to work with things that literally are not in the text. I suppose it has to make a lot of guesses to build a theory of the sema…
Re: FORTH? Really!?
#27I think this deserves a little more thought.