At 17:47 3/07/2009, Gary R. Van Sickle wrote: >But isn't the whole point of LL(*) to eliminate the need to do >exactly this sort of left-factoring? Section 11.3 of Ter's >book gives essentially the former as an example of why LL(*) >makes it so you don't have to do a manual refactoring such >as the latter.
ANTLR v3 is *much* better at dealing with left-commonality than v2 was, but it's still not perfect. And the parser is better at it than the lexer. But regardless, an LL(1)-safe lexer/parser will always give you better performance than something that requires a higher k, so left-factoring is usually beneficial anyway. The main feature of LL(*) in ANTLR is that it automatically decides on an alt-by-alt basis what to set k to; it chooses the minimum it thinks it can get away with (unlike in v2, where you had to work it out yourself, or more commonly just set it at the global level and live with the performance loss). Unfortunately, loops confuse it, and if the grammar isn't factored properly then it can sometimes choose too low a value. 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 -~----------~----~----~----~------~----~------~--~---
