Michael Wood <esiot...@gmail.com> writes:

> How about for things like binary network protocols?  Would you treat
> them the same way as e.g. source code for a language?  Obviously
> there's no "code generation", but you still need to parse it.

As Roberto points out, most common (application-level) network protocols
are textual, not binary.  You can certainly use a parser generator for
textual protocols.  For example Mongrel (a Ruby HTTP server) uses the
Ragel parser generator to parse HTTP requests.  Here's the grammar it uses:

http://github.com/fauna/mongrel/blob/master/ext/http11/http11_parser_common.rl

Actual binary (not-textual) protocols typically aren't languages as
such.  They often just consist of something like this:

[message length] [message type] [payload]

Where [payload] is a fairly fixed structure (think C struct) based on
the message type number.  The payload might have a variable length, but
it's usually rigidly specified by a flag field or pascal-style strings.
Textual parser generators aren't probably all that useful for binary
protocols, however there *are* binary protocol parser generators.  An
example would be Google protocol buffers:

http://code.google.com/p/protobuf/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to