I am looking for a scripting language that can be included in an embedded system to allow the user to pre-configure the unit behaviour based on the system events (I/O port changes, time events…). The sort of control required is
if (some_event)
{
do some stuff
delay N seconds
do more stuff
if (some condition)
{
do something
}
else
{
delay until condition
do something else
}
}
Each of the “do stuff” parts of the would typically be to change the state of the IO or to allow/disallow the processing of one or more events.
There is no requirement for text processing or file handling unless it is required internally by the scripting language implementation.
The processor that I am using has some 8K of RAM and 20K of program store available after the normal operating code has been built. The firmware is written in C, so any source for the scripting language must also be in C.
We use Squirrel for this job. It is similar to Lua, but reference counted instead of garbage collected, so it tends to work better in very tight memory. On the downside, its community is much smaller.
I have also seen Lisp embedded successfully, particularly a Scheme-like derivative.
See also this other StackOverflow question: What are the available interactive languages that run in tiny memory?