Tuesday, August 26, 2008

100 lines of C that can parse any Protocol Buffer � Josh the Outspoken

100 lines of C that can parse any Protocol Buffer � Josh the Outspoken: "There’s lots of misinformation flying around the blogosphere about Google’s Protocol Buffers. One common claim is that you can’t parse a protobuf without having the .proto file. This is false, as demonstrated by This 100-line C program that does just that. It can parse an arbitrary protobuf into its field numbers and wire types. This is pretty closely equivalent to what you get from a generic XML parser, except that with XML you get names for the keys (elements) instead of numbers and strings instead of the four or so wire types that are defined by protocol buffers."