[antlr-interest] Bit Mask Field Indicator  newbie question
    Ashley Neal Hornbeck 
    ahornbeck at yahoo.com
       
    Fri Dec 23 10:10:26 PST 2005
    
    
  
I need to parse network messages from a legacy system.  The messages use a hex
encoded bit mask that indicates which optional fields are present.  For example:
01T105FOO::BAR
01 -> Message Version number
T1 -> Message Type 1
05 -> Hex encoded bit mask - 0000 0101
FOO -> Optional field position 3 (indicated by 0x04)
:: -> Header terminator
BAR -> Optional payload (indicated by 0x01)
There are a number of message types with similar but different structure for this
system.  I am considering ANTLR as a potential solution so I don't have to hand code
a lexer/parser for each of the variants.  So far the only thing I can figure out is
to define 2^8 tokens with a rather large look ahead  not practical.  Being new to
ANTLR I am either missing something or trying to use the wrong tool.
Guidance please.  Am I missing something or using the wrong tool.  If the wrong
tool, any thoughts on another Java solution? 
Thanks in advance,
-Ash
    
    
More information about the antlr-interest
mailing list