Towards a Semantic-Aware Code Generator for Cyber-Physical Systems
Nicolas Hili, Elian Loraux · 2022 11th Mediterranean Conference on Embedded Computing (MECO) · 2022
Code generators are key building blocks in modelling tool environments for embedded and cyber-physical systems. They are responsible for producing efficient and fully-functional code from the models from which the system is built on a target embedded platform. However, generators are usually implemented by hand, therefore, the compliance with the execution semantics of the Domain-Specific (Modelling) Language (DSL) remains implicit and needs to be thoroughly tested. This paper presents a first development of a semantic-aware code generator for cyber-physical systems. The code generator takes as inputs an executable DSL and a model conform to that DSL, and it produces code in a target programming language. The execution semantics of a DSL is specified in OCL/ImperativeOCL and multiple output languages are supported by our generator (JavaScript,$C$++, and Arduino so far). Binding sensors and actuators of an embedded platform to the execution of a model relies on an Observer design pattern built into the artefacts produced by the generator. This paper presents the code generator and its applicability to generate code from various DSLs.