Pages: [1]   Go Down
Author Topic: Yet Another Forth For Arduino  (Read 1919 times)
0 Members and 1 Guest are viewing this topic.
Upstate NY
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

I just posted my Forth environment for the Arduino. It is based on the ANSI Forth draft standard DPANS94, and I've implemented all but one of the core words, plus some others for manipulating the I/O. I would appreciate some feed back from people who are familiar with Forth. It can be found here https://github.com/sdwood68/YAFFA
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6805
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you explain some of the details that are typically relevant in a Forth implementation:

0) is this a full interactive Forth, or some sort of cross compiler?
1) Implementing Forth in a HLL like C++ seems counter-intuitive.  How's performance, and what other tradeoffs and benefits are there (I see a bunch of "throw()" calls.  Does that mean it has real error-trapping capabilities?)
2) Does it have non-volatile storage of any kind for new words?  Support for some sort of filesystem?  If new words are stored in RAM, how much space is available?
3) What's the one (core standard) word you didn't implement?
4) What arduino-specific words have been implemented?
5) Are you going to write any documentation (covering the previous questions)?
Logged

Upstate NY
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you explain some of the details that are typically relevant in a Forth implementation:

0) is this a full interactive Forth, or some sort of cross compiler?
1) Implementing Forth in a HLL like C++ seems counter-intuitive.  How's performance, and what other tradeoffs and benefits are there (I see a bunch of "throw()" calls.  Does that mean it has real error-trapping capabilities?)
2) Does it have non-volatile storage of any kind for new words?  Support for some sort of filesystem?  If new words are stored in RAM, how much space is available?
3) What's the one (core standard) word you didn't implement?
4) What arduino-specific words have been implemented?
5) Are you going to write any documentation (covering the previous questions)?

0) This is an interactive Forth.
1) Implementing Forth in a HLL is slower than assembly, but it greatly improves portability, and I wanted something the was native to the Arduino IDE. As I learn more about the how Forth is suppose to work, I intend to try and improve performance were ever I can. There is limited error trapping. As I learn more, I will improve it. Detected errors cause an end to execution, compilation, or interpretation and the stacks are purged.
2) Currently there is no non-volatile storage. I want to add the ability to store words into the EEPROM and to retrieve them.
3) The last word I have not figured out is ">NUMBER". I can't find any good examples of its use.
4) I've implemented wrappers for pinRead, pinWrite, pinMode, eeRead, eeWrite, analogRead, ananlogWrite.
5) Eventually I will write documentation covering the above and the implementation choices I've made.

I'm welcome to anyone who may want to help. Right know I'm looking into unifying the "Forth Space" in RAM, write now there are seperate memory locations for Name, Code, and Data space. which breaks up the storage of an new word into the multiple areas. The intent is to unify the three areas and make each new word definition occupy a single continuous block of memory.
Logged

Upstate NY
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've updated the code on github. I consolidated the separate memory regions for name, code and data space, into a unified area. I also did some more testing of DO, LOOP, +LOOP, CREATE, DOES>, and RECURSE.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great idea. Congrats. HLL FORTH is fine, you can get the speed you need one way or the other (write in C / asm and wrap it in a word). I am going to give it a try.
Logged

Pages: [1]   Go Up
Jump to: