[antlr-interest] Binary support

The Researcher researcher0x00 at gmail.com
Thu Sep 15 11:06:01 PDT 2011


When I was wanting to parse data structures on disk, I took a look at ASN.1
but realized it was more like a sledge hammer for what I needed.
Interestingly enough what worked best was realizing that C++ can be thought
of as a declarative language for field, structure, array, etc. definitions
and an imperative language for the statements and then stripping out the
declaration part of C++ and using it as the basis for a binary layout
grammar. That's a hint for you Andi.

Eric


On Thu, Sep 15, 2011 at 1:51 PM, Sam Barnett-Cormack <
s.barnett-cormack at lancaster.ac.uk> wrote:

> I did some work with ASN.1 a while back. If it weren't for some ethical
> issues, I'd go back to doing it on my own time, to try and make a java-based
> tool to handle ASN.1 stuff. The problem with ASN.1 is - what bit of it are
> you talking about? Which encoding? How feature-complete? Which version? It's
> all a bit foggy. It would also only be helpful for any binary format which
> could be described using ASN.1, which isn't quite all of them.
>
> Sam
>
>
> On 15/09/2011 18:36, The Researcher wrote:
>
>> seems to be an uncharted territory?
>>
>> See: http://en.wikipedia.org/wiki/**Abstract_Syntax_Notation_One<http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One>
>>
>> There are ANTLR gramamars for it. http://www.antlr.org/grammar/**list<http://www.antlr.org/grammar/list>
>>
>> *ASN.1*<http://www.antlr.org/**grammar/1231433381400/ASN.g<http://www.antlr.org/grammar/1231433381400/ASN.g>>
>>   and *SMI/SPPI/ASN.1
>> parser*<http://www.antlr.org/**grammar/1105770765162/**
>> parsesmi-v1-15jan05.zip<http://www.antlr.org/grammar/1105770765162/parsesmi-v1-15jan05.zip>
>> >
>>
>>
>> Of interest might be
>> http://www.wireshark.org/docs/**man-pages/wireshark-filter.**html<http://www.wireshark.org/docs/man-pages/wireshark-filter.html>
>>
>> Eric
>>
>>
>>
>>
>> On Thu, Sep 15, 2011 at 1:07 PM, andreas kleiber<kleibi at gmx.net>  wrote:
>>
>>  Hi Eric,
>>> thanks for the prompt answer.
>>>
>>>  Something you might want to do, but this is reinventing the wheel, is to
>>>> create your own grammar that defines binary layouts, and then use that
>>>> as
>>>> input into a driver that reads the binary file. I have done both of
>>>> these
>>>> and the latter is the better option.
>>>>
>>>
>>> You're describing exact the situation I didn't want to face. ;-)
>>>
>>> The "ANTLR was not designed for binary files" point: This is why I think
>>> "if ANTLR is another tool for language recognition -- are binary files
>>> not
>>> also languages?". Or in other words: Wouldn't it be the least effort to
>>> add
>>> the functionality to ANTLR? Of course I don't know the ANTLR code at all,
>>> so
>>> I can't really comment on that but if it's designed well I could imagine
>>> that it would be possible to add at least some of my proposed features.
>>>
>>> BTW I'm wondering that I found so less posts on binary topics. And at
>>> least
>>> I'm not aware of another tool that's able to generate code for reading
>>> binary files -- seems to be an uncharted territory?
>>>
>>> Andi
>>> --
>>> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
>>> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.**gmx.de<https://freundschaftswerbung.gmx.de>
>>>
>>>
>> List: http://www.antlr.org/mailman/**listinfo/antlr-interest<http://www.antlr.org/mailman/listinfo/antlr-interest>
>> Unsubscribe: http://www.antlr.org/mailman/**options/antlr-interest/your-*
>> *email-address<http://www.antlr.org/mailman/options/antlr-interest/your-email-address>
>>
>
>


More information about the antlr-interest mailing list