ANN: protocol-buffers (very early edition) version 0.0.5

Hi all, The Haskell version of protocol-buffer is still pre-bootstrap, but further, so there is a 0.0.5 release on http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers and a darcs repository on http://darcs.haskell.org/packages/protocol-buffers/ The leading 0.0 in the type should show how early this code is :) What are protocol buffers? The are google's data interchange format: http://code.google.com/apis/protocolbuffers/docs/overview.html
What are protocol buffers?
Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format.
In addition to a manual translation of the self describing 'decriptor.proto' it has a partial code generator in Gen.hs and a stub of a parser in ProtoParser.hs and an intermediate data type in WireMessage.hs that I expect to sit between the byte stream reader/writer and the message types. Eventually the parser with read 'decriptor.proto' and the generator will emit source code to replace the manual translation. FAQ 1: Why is the Text.DescriptorProtos.* hierarchy so huge and the imports so plentiful? ANSWER 1: The namespace management. The namespace paradigm is the nested OO style namespace of C++, so I need modules and imports to fake nested Haskell namespaces. Cheers, Chris Kuklewicz

Announcing the Haskell version of protocol-buffers, version 0.1.0. This is still pre-beta. The darcs repository is at http://darcs.haskell.org/packages/protocol-buffers/ There is an (untested) tarball at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers The original google version of protocol buffers is at http://code.google.com/apis/protocolbuffers/docs/overview.html After tinkering for a while, the Haskell protocol-buffers package is now able to bootstrap the descriptor.proto file from the google source. The lexer & parser can handle the full unittest.proto from the google source. The Lexer.hs module is created from "Lexer.x" by the Alex program (I am using Alex version 2.2). The basics for the wire protocol are there, but have not been tested and need a small high level API. There is no actual program yet. The closest thing to an entry point is the "Text.ProtocolBuffers.Bootstrap" module which shows how I generated the modules from descriptor.proto. Notes on the current implementation: The messages become Haskell record data types with 1 constructor and an individual module for namespace management. The fields become Haskell record names, optional fields are wrapped in Maybe repeated fields are wrapped in Seq (from Data.Sequence) Enumerations become Haskell data types with an individual module for namespace management. The enum values become different Haskell constructors for the type (no arguments) Wire protocol implemented on top of binary Get and Put monads (to and from Lazy ByteString) Some reflection is possible (via type classes) Todo: Make the Lexer check that TYPE_STRING default values are valid UTF-8 (easy). The handling of default string/bytes in Gen.hs is not quite right and will need to be fixed (easy). The next things to add are full support for TYPE_GROUP and then support for extensions (easy and medium). Check that the Lexer properly handles /* block style */ comments. Test the wire protocol versus google's implementation. I have not even started looking at serivice/method/rpc support. Cheers, Chris Kuklewicz
participants (1)
-
Chris Kuklewicz