While wiring up hpp generation in my branch of libuavcan I kept trying to keep the repo focused on the c++ source but ended up writing as much build logic and configuration to manage the python “dsdl_compiler”. Because of this I’m now convinced that the best design for libuavcan and for the UAVCAN project is to create a generic
dsdl-compiler dsdl-code-generator as its own repository and to pull it back in as a pypi dependency to libuavcan.
As such I propose “pydsdlgen” which I’ve roughed out here:
While pydsdlgen is somewhat language agnostic it will provide only C++ syntax helpers in the template DSL it defines initially. However, it should be easy for additional syntax helpers and escaping extensions to be developed which would allow this script to be used to generate additional languages.
Below is a quick dependency diagram showing how a program could use pydsdlgen by depending on it and providing it a set of dsdl types and Jinja2 templates.
In the case of a libuavcan-based software the dependencies would look like thus:
This modularity should fix the currently painful experience applications have when trying to use custom dsdl with libuavcan v1 and could even allow applications to develop their own header templates to use with libuavcan v2 maximizing their ability to generate highly optimized code for resource constrained systems. Finally, this proposal relieves the C++ libuavcan repo from having to build, test, and distribute a python application.
If this proposal is accepted I will create the pydsdlgen repo in the UAVCAN github organization and hook up travis, coveralls, and pypi for it.