[antlr-interest] Parsing Binary Files with ANTLR V3.x? Any examples?

Terence Parr parrt at cs.usfca.edu
Wed Aug 9 11:31:59 PDT 2006


On Aug 9, 2006, at 11:08 AM, jarrod roberson wrote:

> anyone have any examples on how to parse binary files with ANTLR V3?
> I have looked everywhere and can't find anything substaintial.

I have not tried yet, but you'll probably need a new stream other  
than CharStream.  ANTLRByteStream perhaps.

Then, just use unicode '\u00xx' chars in your lexer.
Ter

> I have a very basic fixed length binary header that I need to parse,
> and instead of writing a parser for C, Java and Python, I want to use
> ANTLR to generate them so I only have to manage one file when I get
> ready to update the headers.
>
> I know the V3 generators for Python and C might not be cutting edge,
> but I wanted to try and be as forward looking as possible.
>
> I can always fall back to 2.x if 3.x isn't ready for prime time.
>
> Thanks in advance.



More information about the antlr-interest mailing list