Chat freely about anything...

User avatar
By craiglindley
#36101 Hello,

I've been writing a Forth like language for the ESP8266 and I wanted to share what I have done. I call it Forth like because I didn't really follow any standards but coded up the words I thought would be useful. The code is far from complete or robust but I thought other Forth addicts out there might enjoy playing with it and extending it for real world applications. I'm not that good of a C++ programmer so please be gentle with your criticism of my coding style. The Arduino code is available at:

http://craigandheather.net/misc/ESP8266Forth.zip

For development I used Arduino IDE version 1.6.5 and the 2.0 version of the Arduino-esp8266 code.

There is no documentation but that may change as time goes on. Currently you interact with the code via the Serial interface and you can load Forth code from named files stored on an attached SD memory card. The word "cold" pulls the reset line of the ESP8266 and allows for a complete system reset.

With this version of the code there is still about 75% of the flash free and about 50% of the RAM free so in theory you could write rather long programs. And what may not be obvious to non Forth programmers is that all the development tools are already in place so you develop new code on the ESP8266 itself.

Anyway enjoy. Let me know what you think.

Craig Lindley
User avatar
By craiglindley
#36279 I may put the code on github but I've been looking at changes for memory management and my work space is not in any condition to upload at the current time.

Because I used dynamic allocation in the code, heap is consumed by many of the words and this memory is not returned when you forget words from the dictionary. It is therefore recommended that users execute "cold" between compilations as this will reinitialize the ESP8266 and the heap back to its default values.
User avatar
By Mmiscool
#36290 I am very interested in any advanced parsing routines complex math. How is this handed in your interpreter?