Hi Andi, I have actually tried to modify ANTLR to read binary files and I eventually set it aside and went in a different direction. I did so knowing that it might not be right but to also understand WHY it might not be right. One of the first things you will learn on this endeavor is that K=0 because you know the layout of the binary data. If you are trying to write a parser to parse unknown binary formats, as Ron mentioned, then K>0 and since not all of the patterns are known, success may not be achieved. This is where PROLOG comes in handy.
Another aspect of binary files is that they tend to be context sensitive and AFAIK ANTLR was not designed to handle Type 1 grammars. See http://en.wikipedia.org/wiki/Chomsky_hierarchy You also have to deal with unions and tagged unions. See http://en.wikipedia.org/wiki/Union_(computer_science) http://en.wikipedia.org/wiki/Tagged_union How would ANTLR retain the tags, or should the grammar designer be responsible for maintaining them like a symbol table. While I will point this out because you should be aware of it, I am not recommending it. I haven't worked with ANTLR v4 yet, but you can give it a test by getting it from https://github.com/antlr/antlr4 >From a practical stand point, if ANTLR were modified for this, how much change would it cause for those not parsing binary files. I don't suspect that the other target grammars would use it, so only the Java target would have it. And since Java is not bit friendly, you change one problem for another. Eric List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
