Actually i intended to ask a question, whether there are any cases under which i should prefer predicates than increasing the value of k. Is it a very obvious one???
Gokul. On Thu, Feb 11, 2010 at 4:37 AM, Gokulakannan Somasundaram < [email protected]> wrote: > Hi, > I observed the code generated for antlr parser and understood this. > a) If i have set k = n, ANTLR keeps trying to resolve the grammar by > reading further tokens(max n tokens), if there is an ambiguity > b) Once it has read n tokens, then it tries the syntactic or(and) semantic > predicates and chooses the first alternative that satisfies the predicate. > This is implemented with if- condition, whereas the resolving of n-tokens, > happen through switch-case. > > Now if i have a grammar(say with k=2) and the only way i can convert it > into k=1 is by using predicates, i think i am better off staying with a > higher value of k. In any case converting my grammar would produce x > ambiguity warnings in y rules. We can be sure that (x >= y). So even in the > best case of x=y ( i.e. each rule produces one ambiguity while converting to > lower k and each one can be resolved by one if-condition), i am just > replacing switch..case by if..condition. > > So i feel it is better off to stay with a higher value of k, than to > resolve by predicates. Can i safely make this assumption? > > Thanks, > Gokul. > > > 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.
