Posted By:
James_Tsan
Posted On:
Tuesday, March 2, 2004 12:28 PM
I have two questions about the applications of ANTLR. First, the ANTLR parser applies the grammar in the whole file. Is it possible to define a grammar which can be used to detect if some segments of the binary file meets this grammar by ANTLR? For example, the grammar is defined as (0x50..0x52)+ 0x8e. A segment of the binary file looks like as follows 0x90 0x66 0x50 0x71 0x21 0x50 0x51 0x52 0x8e 0xee 0xcc. Thus, this segment can be found by using the grammar. And, the other pieces of code can be just ignored without any definition of grammars. Secondly, is it possible to add a counter to count the number of (0x50..0x52)+ in the p
More>>
I have two questions about the applications of ANTLR.
First, the ANTLR parser applies the grammar in the whole file. Is it possible to
define a grammar which can be used to detect if some segments of the
binary file meets this grammar by ANTLR?
For example, the grammar is defined as (0x50..0x52)+ 0x8e.
A segment of the binary file looks like as follows
0x90 0x66 0x50 0x71 0x21 0x50 0x51 0x52 0x8e 0xee 0xcc.
Thus, this segment can be found by using the grammar.
And, the other pieces of code can be just ignored without any
definition of grammars.
Secondly, is it possible to add a counter to count the number of
(0x50..0x52)+ in the previous example while doing the parse?
Any of your response is highly appreciated.
Thanks.
<<Less