The first programming language I learned back in 80’s was BASIC. BASIC was never considered a professional language, but the more modern Visual Basic was and is still in heavy usage as both programming language and scripting language. Python have taken over for a lot of scripting and is making it’s way into heavier applications these days, but Python requires a lot of Flash to be running.
My own plans for PLAIN is stalling a bit due to it’s complexity, but I often wondered how much would it take to create a scaled down scripting language that can be used embedded. I recall 8052AH having PBASIC as far back as 1979 and for those who don’t know it BASIC was for years the language that ran on most computers in the world. Computers used in washing machines and coffee tractors etc.
The rationale of this is easy to see in Arduino’s wire lib. It is popular because it is easy to blink a led and many applications only need a few sensors and digital outputs.
So, how difficult is it to create an embedded scripting language that look like a scaled down version of PLAIN? To be honest – not much.
PLAIN is great, but it is still a language that needs to be compiled and downloaded. What I would like is a small interpreter that I can integrate into a CLI/Shell and write commands on the spot. I can do that with Python, but it is a large package + I am not a big fan of Python.
I want to use C++ and I target a minimum of 64Kb Flash and 20Kb SRAM. This fits the low end STM32 and maybe I can tune it down to faciliate smaller MCU’s, but that is for later.
I want a simple, classic interpreter that execute as we parse to minimize system requirements.
Lets work on the language:
|int8||8 bit signed integer|
|int16||16 bit signed integer|
|int32||32 bit signed integer|
|uint8||8 it unsigned integer|
|uint16||16 bit unsigned integer|
|uint32||32 bit unsigned integer|
|real32||32 bit float|
|record||packed variable collection that can be declared on a selected address|
|declare||uint8 varA = <init expression>|
|assign||varA = 3 + 4 * 5|
|func||func MyFunc(uint32 pA…) : uint32
|for||for x = 1 to 10 step 1
|if …||if < expression >
elseif < expression>
|Save||save < name>|
|Load||load < name>|
|print, println||print functions. Will output text to a build-in console IO, usually an UART or similar.|
This is a very minimalistic approach, but we can add context later as we need them. I will in addition link up the system library from PLAIN and enable add-on content from the platform package.
My own usage is as a CLI/Shell language and I want capabilities like auto-start of shell scripts etc.
Most of my modules have USB that is excellent as a high speed serial port, so a user install a simple console app and plug in a module and voila – he/she can operate or program that module directly.