Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to choose a proper Python parser generator to parse C struct definitions?
    primarykey
    data
    text
    <p>I am working on a project which contains two servers, one is written in python, the other in C. To maximize the capacity of the servers, we defined a binary proprietary protocol by which these two could talk to each other.</p> <p>The protocol is defined in a C header file in the form of C <strong>struct</strong>. Usually, I would use VIM to do some substitutions to convert this file into Python code. But that means I have to manually do this every time the protocol is modified.</p> <p>So, I believe a parser that could parse C header file would be a better choice. However, there are at least <a href="http://nedbatchelder.com/text/python-parsers.html" rel="nofollow">a dozen of Python parser generator</a>. So I don't which one is more suitable for my particular task.</p> <p>Any suggestion? Thanks a lot.</p> <hr> <p>EDIT:</p> <p>Of course I am ask anyone to write me the code.... </p> <p>The code is already finished. I converted the header file into Python code in the form that construct, a python library which could parse the binary data, could recognize.</p> <p>I am also not looking for some <strong>already exist C parser</strong>. I am asking this question because a book I am reading talks a little about parser generator inspired me to learn how to use a real parser generator.</p> <hr> <p>EDIT Again:</p> <p>When we make the design of the system, I suggested to use Google Protocol Buffer, ZeroC ICE, or whatever multi-language network programming middleware to eliminate the task of implementing a protocol.</p> <p>However, not every programmer could read English documents and would like to try new things, especially when they have plenty of experience of doing it in <strong>old and simple</strong> but a little clumsy way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload