A question came up on the JavaCC user's list about parsing binary data with JavaCC. In response I posted a little example grammar that parses the header section of a DOOM map data file (e.g., a WAD file). There's really not much to it; here's the lexical spec:
And the syntactic spec:
Here's the utility function to decode those little endian ints to Java ints:
Most of the above bit shifting stuff is based on this helpful page, and some notes on the DOOM map file format are here. Hm. This sort of thing may be a good late addition to my JavaCC book.