Scripting language interpreter for larger programs

Hi there! I am developing a program that is starting to get a bit large, and I'm starting to hit the RAM limits of my arduino board. To solve this kind of issue, I thought it would maybe be possible to create a scripting language that can be compiled to bytecode (for a smaller size), and an interpreter to be uploaded to the arduino board. The arduino would read from an SD card, which would contain the byte-code executable, and run it.

Could this be worth it? I don't intend to flash the arduino itself with the byte-code, but rather have like a "kernel" layer that interprets code stored in the SD card. At first I was going to just develop my project using a raspberry pi, but that would mean a fully fledged OS, which is less suitable for what I am developing since I need to be able to reliably use interrupts, which Raspbian struggles with.

The main issue I think this project will encounter would be the RAM limit of the board anyways, as the bytecode would require being loaded into memory in order to be executed. However, it would be possible to implement "virtual RAM" by using the SD card itself as RAM, and just cache the stuff immediately needed on the real RAM. This would slow down execution speed, but speed is not my main concern.

I'm sorry if this is a bit confusing, English isn't my first language and I sometimes struggle to clarify. If you have any questions or suggestions I'll be happy to read and reply!

In general I would like to know if this is a good idea at all or if it would be too complex to be worth it

Why not buy an Arduino with more RAM, and save yourself a mountain of trouble?

I believe CircuitPython can run python code from local storage.

1 Like

.. or maybe uLisp uLisp - ESP32 boards

Because this is also a good excuse to create a scripting language, which I've been meaning to do for some time, but didn't find a good reason to. I also think it that it would be nice to have an alternative solution to just "throw money at it".

Other boards also can run into the problem of not being big enough (as in, being limited by their number of pins), which is also a thing that keeps me using an Arduino Mega 2560

You can check out my interpreter, the main part is fairly portable and it'll run on any AVR with EEPROM.

The interpreter link....Fast Interpreter.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.