Is anyone developing Daisy code in Forth?

The subject pretty much says it all - I’d like to have a nice compact Forth interpreter that runs in a Daisy if possible. I have a cross-compiler but the license won’t let me ship a Forth interpreter, so I need one of those too.

I would guess that the number of Forth developers on Daisy would be comparable to people writing in Cobol and Fortran. That should be read as “pretty much zero”. Currently you can run code written in:

  • C
  • C++
  • Rust
  • PureData
  • gen~

The last 3 are just compiled to C++. Cross-compiling other languages to C++ (or C wrapped into C++ code) is certainly possible. One thing to beware of is that you have to fit the whole firmware into 128kb of internal flash, which may end up a limitation if you need to support a lot of peripherals in addition to the interpreter. There is a separate 8Mb chip, but you can’t flash it directly over USB.

It would be interesting to hear why do you want to run interpreted code on a microcontroller in first place, considering its overhead compared to compiled code. I imagine using for something like livecoding could be a valid use case.

While not a Daisy, synstack is a musical forth environment designed to run on a stmf4 discovery board. Maybe it could be adapted to work with the Daisy?

1 Like

Livecoding is indeed the application I had in mind; Forth is the only interpreter compact enough to do this. There’s no overhead in the audio rate / DSP code because it can be written in assembly. All the overhead is at the control rate.

I did find an open source microcontroller Forth that looks promising but I don’t know how deep the community is - the repo is on SourceForge, for example, and the documentation site is run by a hobbyist like myself.

Mecrisp Stellaris Unofficial UserDoc

I have it running on my NVIDIA Jetsons and in an emulator on Windows Subsystem for Linux so I can test everything except the audio rate code externally.

The alternative would be to write a Forth interpreter in C/C++ or Rust. There are plenty of them in C already; gforth will probably work but it may be too big. Rust would be my choice if I already knew Rust, but I don’t. :smiley:

That does look promising. I want less than what I saw there - just a Forth interpreter / colon compiler with the audio / DSP libraries in C or assembler and a USB connection to a host Windows / MacOS / Linux terminal application.