I run an electronics shop at a university. From time to time I need an embeddable interpreter so people in the labs can write a small program to do what they want with one of my hardware projects. For example, I have an XYZ stage controller that is moved with stepper motors. A Teensy controls the hardware and I'd like users to be able to write something like:
for i = 1 to 10 do
move_x(10);
delay(100);
if (i == 10) move_y(10);
end;
So a "tiny C" or "tiny Pascal" interpreter would work. The user would write the program then download it over the serial port to the Teensy where it would be compiled to bytecode or directly interpreted. I found Adam Dunkels' uBasic, https://github.com/adamdunkels/ubasic, which would actually do what I want but I don't like the idea of having to use line numbers.
I also found Pico-C, https://github.com/jpoirier/picoc, but it runs to 3500 lines of C, so it's not so small. Whatever I use, I need the source code so I can modify and extend the language. Does anyone have recommendations?
for i = 1 to 10 do
move_x(10);
delay(100);
if (i == 10) move_y(10);
end;
So a "tiny C" or "tiny Pascal" interpreter would work. The user would write the program then download it over the serial port to the Teensy where it would be compiled to bytecode or directly interpreted. I found Adam Dunkels' uBasic, https://github.com/adamdunkels/ubasic, which would actually do what I want but I don't like the idea of having to use line numbers.
I also found Pico-C, https://github.com/jpoirier/picoc, but it runs to 3500 lines of C, so it's not so small. Whatever I use, I need the source code so I can modify and extend the language. Does anyone have recommendations?