Clojure Model as Modelling Language for Embedded Software

I think about the idea of using Clojure as a modelling language for safety critical Embedded Software. I could imagine that a small subset of Clojure would fit well for specifying, testing and analysing algorithms.

Developers of safety critical software are often very restricted to a few data types and some basic operations. I could even imagine that with such restrictions it is not much effort to write a code generator that takes Clojure code and generates for example C or Ada code. The subset of Clojure could be very restricted. No dynamic memory even. No dynamic behaviour, at all. No anonymous functions. Just a few very basic language mechanisms.

The language concepts and data structures of C and Clojure are obviously different. But it should be relatively straighforward to implement a mechanism that converts let expressions into a list of local vars. Mutable data structures are not often needed in embedded software. The static types that C needs can be speficied in meta data. Meta data would also be an interesting way to implement a concept for traceability in the development process.

Has anybody an idea how ambitious all this would be? When I see that people write their own Clojure compilers that compile to JavaScript, I could imagine that a compilation to other languages would also not be challenging.

Prior (current?) art:

Hi,

I think you should using a restricted subset of Clojure for modeling safety critical embedded software is a promising idea, especially for specifying testing and analyzing algorithms. Writing a code generator to convert this subset of Clojure to C or Ada would be ambitious but feasible particularly given the success of other Clojure to JavaScript compilers. The key challenges would be ensuring the subset adheres strictly to safety critical constraints and efficiently mapping Clojure constructs to the target languages.

Thanks