Forth and AI

25 views
Skip to first unread message

The Beez

unread,
Mar 29, 2026, 7:41:32 AM (11 days ago) Mar 29
to 4tH-compiler
Hi 4tH-ers!

Maybe you're not aware of it, but I've been playing with Forth and AI for a long time. My mission was simple: write me an integer square root routine.

I started with OpenAI - and frankly, what came out of it was completely unusable. Worse, it didn't do the requested corrections - and even maintained that a correct word I submitted wasn't correct. So I abandoned it.

BTW, what it did do very well was to explain uncommented Forth source - really remarkable. And at one of those occasions it did correctly replicate my BASE&EXEC word. I mean - literally.

Since then I've used Gemini and finally Grok. And that last one did as a matter of fact produce completely correct code. You will find it shortly as MSQRT in SVN. Gemini did produce a correct C version - which I replicated in both 4tH as well as uBasic/4tH.

So, I can't tell you what the future will bring, but the chances are that more AI code will be added. Not that I'm not moving to "vibe coding", it's just where technology seems to be going - and I think we must at least test the possibilities.

Now - I know very well that the Grok code may just be the result of merely reciting existing code - I'm not naive. I'll have to find that out as well.

I that sense, I've tested the ability of the AI to handle the stack. The problem begins when there are more than 3 elements to handle. That's a complexity level where newbies start to mess things up. Also, it doesn't always use the return stack to compensate for the complexity.

However, it is an interesting subject. Now, what I want to know is:
  1. Are others using AI to generate Forth? What are your experiences?
  2. How do you feel about AI generated code in the 4tH repository?
If you have any thoughts on this, please share them with me.

Hans Bezemer

Phillip Kelly

unread,
Mar 29, 2026, 7:56:03 AM (11 days ago) Mar 29
to 4th-co...@googlegroups.com
Hans,

It may have been myself that enriched AI you seem to have experienced, as I have tried to use Chat got for coding 4th routines some time ago. 
However, I was not overly impressed with it's responses.
That said, I would expect that my attempt to have it recognise your 4th code may have triggered the algo to perform deeper research and add your 4th to it's knowledge database.

I say this because I was very careful to ensure to associated your 4th by using your name when entering queries.

I hope I haven't messed with the future of your 4th too badly.

Yours Sincerely
Mr. Phillip Kelly
 






--
You received this message because you are subscribed to the Google Groups "4tH-compiler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 4th-compiler...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/4th-compiler/1c7f0d00-8e26-482a-bc2e-2093f8fff58fn%40googlegroups.com.

Ron K. Jeffries

unread,
Mar 29, 2026, 3:12:10 PM (11 days ago) Mar 29
to 4th-co...@googlegroups.com
What you are pursuing is very smart, and being done in an intelligent, low risk way,
---
Ron K. Jeffries






--

The Beez

unread,
Mar 30, 2026, 10:03:39 AM (10 days ago) Mar 30
to 4tH-compiler
Oh no - you didn't mess with its future too badly, I assure you! ;-)

I recently wrote a simple routine to convert a hex string into a binary string (in place) and asked it whether it could identify the dialect. It thought it was Gforth. I was almost insulted! ;-)

In much earlier sessions it contributed 4tH to Marcel Hendrix - and although I really respect Marcel, it was one of those infamous "hallucinations". I don't think Marcel would be happy with that, BTW ;-)

Nowadays though, its responses are far more detailed - and make a lot of sense most of the time. That doesn't mean it's always correct, though - as the following document demonstrates.

Hans Bezemer
HexConv4tH.docx

The Beez

unread,
Mar 30, 2026, 10:30:39 AM (10 days ago) Mar 30
to 4tH-compiler
Sorry - it contributed 4tH to Albert v/d Horst. He won't be happy either! ;-)

"4tH (pronounced "forth") is a Forth compiler and interpreter that can generate stand-alone executables for a variety of platforms, including x86, ARM, and AVR microcontrollers. 4tH includes extensions to the standard Forth language to support structured programming, high-level data types, and other features commonly found in modern programming languages. The name 4tH is a pun on the phrase "Fourth Generation," which was commonly used in the 1980s to describe high-level languages that were designed to be easier to use and more powerful than their predecessors.

Who wrote 4tH

4tH was created by Albert van der Horst, a Dutch programmer, in the late 1990s. The project is still actively maintained and has a community of users and contributors from around the world."

Hans Bezemer


Nick Römer

unread,
Apr 6, 2026, 4:32:41 AM (4 days ago) Apr 6
to 4th-co...@googlegroups.com
In Forth, the Netherlands punch above their weight. How come?

The Beez

unread,
Apr 6, 2026, 11:03:33 AM (3 days ago) Apr 6
to 4tH-compiler
I don't know. I mean, sure there has always been a "Forth culture" in Holland, going back to the eighties. It never was a *huge* number of people, but I consider them to be very talented. To give you an idea, when I published my first FD article, they were very surprised "Who is that guy?!" Because they assumes they knew *everybody* in the Netherlands that did Forth.

But the Dutch have always punched above their weight in computer science. Edsger Dijkstra, the guy of "GOTO considered harmful?" Dutch. Guido van Rossum, of Python fame? Dutch. Jaap Haartsen, Bluetooth? Dutch. Wikipedia has dedicated an entire page to Dutch computer scientists. https://en.wikipedia.org/wiki/Category:Dutch_computer_scientists

Maybe it is because Dutchies are pragmatists - in the sense that "good enough is good enough. And Forth fits that bill very well. But that's just me theorizing..

Hans Bezemer

The Beez

unread,
Apr 6, 2026, 11:32:41 AM (3 days ago) Apr 6
to 4tH-compiler
According to Gemini, I may not be too far off :-)

The over-representation of the Dutch in the Forth community stems from a combination of early technological adoption, academic influence, and a cultural affinity for efficiency and direct control over hardware. Key factors include the early adoption of Forth in Dutch astronomical research, the development of robust Forth dialects, and a "DIY" mentality that fits the language's philosophy.
1. Early Academic and Scientific Adoption
  • Forth's Early Presence in Netherlands: Forth was adopted early in the Netherlands, notably at the University of Utrecht in the early 1970s for astronomical research.
  • Astronomical Standard: Following the success of these early systems, Forth was adopted as a standard language by the International Astronomical Union, cementing its use in European scientific research, where Dutch astronomers were influential.

2. Key Dutch Figures and Tools
  • Albert van der Horst (ciforth): The Dutch community is known for strong practitioners like Albert van der Horst, who maintained "ciforth" (a portable Forth) and has over 40 years of experience, contributing to the language's stability in the region.
  • Transputer Forth (tForth): Dutch developers were involved in early, specialized Forth implementations such as tForth for transputers, which were popular for parallel computing in the late 1980s.

3. Cultural and Technological Factors
  • Engineering Mentality: Dutch culture often emphasizes efficiency, practical engineering, and solving problems directly. Forth, which is designed for embedded control and offers high-speed interaction with hardware, appeals to this engineering mindset.
  • DIY/Hobbyist Culture: The "Forth Interest Group" (FIG) promoted a strong culture of free exchange and hobbyist development, which found a welcoming environment in the Netherlands in the 1970s/80s.
  • Resistance to Overhead: Forth allows developers to bypass traditional "heavy" software layers, appealing to a "no-nonsense" approach to software development.

4. Small Country, Strong Network
  • Proximity: The small size of the Netherlands allowed for a tightly-knit network of professionals and academics to share developments, leading to a concentrated, knowledgeable community compared to larger, more fragmented nations.
  • While Forth is a niche language today, its history in Dutch astronomy and technical applications created a long-standing "old guard" of Dutch Forth programmers who continue to be active in the community.


On Monday, April 6, 2026 at 10:32:41 AM UTC+2 niveau...@gmail.com wrote:

Ron K. Jeffries

unread,
Apr 6, 2026, 11:54:40 AM (3 days ago) Apr 6
to 4th-co...@googlegroups.com
Well said 


---
Ron K. Jeffries




--
You received this message because you are subscribed to the Google Groups "4tH-compiler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 4th-compiler...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages