I want to use python to parse proto file, and generate .h/.c file under the constraints of the misra C specification. I hope to get a python package that satisfies: Parse the proto file to get the definition of the internal message (there is no Service definition in my project), it would be best if you can correctly parse the import related files.
May I ask, is there such a python package?
There are several python packages that can be used to parse .proto
files and generate .h/.c
files that comply with the MISRA C specification.
One package is protoc-gen-c
, which is a plugin for the Google Protocol Buffers compiler (protoc) that can generate C code that adheres to the MISRA C guidelines.
Another one is protobuf-c
, a pure C implementation of the Google Protocol Buffers data serialization format. It can also generate C code that comply with the MISRA C specification.
Yet another one is protobuf-c-compiler
, which is is designed to parse the proto file and generates C files and includes a flag to enable the generation of code that complies with the MISRA C specification.