Skip to content

Notes to self

Bouke Grevelt edited this page Sep 28, 2017 · 6 revisions
  • Our proposed grammar is flexible enough to describe any binary format. However, the parser generator would have to be very complex to fully support the grammer (probably similar to 'real' parser generators like ANTLR in complexity. It may be worthwhile to introduce some restrictions (in lexical analysis) to reduce the complexity.
    • Fixed fields must be the same for all (root level) objects in type and size and only one fixed value may be different for different objects. e.g.

      Object1
      {
          header : uint32 = 0x01020304;
          message_type : uint8 = 1;
          field1 : int16;
          field2 : float32;
          (...)
          footer : uint32 = 0x04030201;    
      }
      
      Object2
      {
          field1 : int16;
          message_type : uint8 = 1;        
          field2 : float32;
          (...)  
      }
      

      is not allowed.

      This would make generating a parser a lot easier since we don't need complex iteration of tokens and backtracking. Instead we can simply find the start of a packet and determine the type based on the differing fixed value.

Clone this wiki locally