Skip to content
Bogi Napoleon Wennerstrøm edited this page Jun 16, 2018 · 1 revision

C in Backus Naur Form

Writing a program to run on the Arduino platform which requires multiple processes to be run simultaneous can very complex. Since most, if not all, Arduino boards only have a single processor, parallelisation is not possible. The second best option is concurrency, which swaps the running tasks so fast that it appears to be parallel. But of course, the answer is not that easy to implement. The most common way, is to write a script a like the script on figure 1.

void loop(){
    int time = millis();
    if(time % 3 == 0){
        turnOnLED();
    }
    if(time % 6 == 0){
        turnOffLED();
    }
}

Figure 1. A simple concurrency emulation on Arduino

This way of writing concurrency can be very tedious, and can become very complex. This way also doesn’t handle blocking threads. Which means that an infinite loop will block all other tasks that need to be handled.

We suggest a language for the Arduino platform, which allows for native concurrency, by defining threads as a primitive. A language, that would handle swapping tasks, by saving their state, loading the state of an another task, and resuming the processor. This procedure would run in either x amount of cycles, or x amounts of time.

The goal is not to create a new C language, but rather to add to the already existing C foundation. The goal is to let people, who already know Arduino, to do things, that might otherwise be to expensive. Our language will therefore look a lot like C, but with a few added features. One can also expect that all C features will NOT be implemented, as most of them would be considered out of scope (e.g floating point numbers).

But wishful thinking. On the next pages, you’ll find our wished list of features. The next step is to define the minimum set of features needed. Everything else can come later.

Good reads & references

Clone this wiki locally