My current project requires that I read data that is stored in configuration files and generate hardware-abstraction-layer code from it. The configuration data structures describe digital hardware in a low-level way (components with registers/bitfields, power on reset values and so on). From this data I need to autogenerate Python code that can be used by other application developers in order to write applications on top of it. Like I said before, the idea is to provide a HAL for the higher-level application.
My question is: What would be your approach to solve this problem? To me it feels natural to use Python for the code generator. I don't know if there are better tools for this task (yacc/bison?). My design idea would be to have a static program component gets redistributed and handles the communication handling, logging and all the generic stuff. The other component that is hardware-dependent would be completely autogenerated and use the API of the static component.