[antlr-interest] ANTLR 3 using k=0, any info on doing this?

Terence Parr parrt at cs.usfca.edu
Wed Mar 2 10:16:43 PST 2011


Use {...}?=> for this.It forces the predicates to be tested regardless of whether or not the lookahead predicts an alternative.

Ter
On Feb 28, 2011, at 6:12 PM, The Researcher wrote:

> I tried searching the interest group with k=0 but that wasn't productive,
> and Google doesn't do any better.
> 
> Yes I know setting k=0 is not what one normally if ever does with ANTLR, but
> I am researching what it will take to get ANTLR to validate a Microsoft
> Common Language Infrastructure file. I did write a separate validator by
> hand and that works great.
> 
> One of my goals out of this is to have a way to write binary file readers
> and validators using ANTLR. Yes I know that I will have to modify ANTLR.g to
> do this correctly, but before that, I have to know what the current ANTLR.g
> is capable of doing and what needs to be modified or enhanced.
> 
> So far I have only fond the ANTLR 2 Java .class file reader by Andreas
> Rueckert and the few mentions of using Bytes in "Definitive ANTLR
> Reference". I am getting the other book.
> 
> Using gated semantic predicates is working out great, but ANTLR is
> determined to check for multiple alternatives. I was hoping that K=0 would
> shut that whole process down  and using the gated semantic predicates to
> dynamically shut off the options would leave ANTLR not trying alternatives.
> 
> Any clues or references are welcome.
> 
> Thanks Eric
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list