FYI, the gazelle parser project (prototype) also aims at something similar, with slightly different syntax. Having non-greedy parsing in ANTLR also at the grammar level would be really useful, especially for languages without reserved identifiers. But I guess it's not an easy hack that one would do over a weekend.
George S. Cowan schrieb: > Certainly make '.*' and '.+' consistent across all the grammar types, one > way or the other. > > The real issue with '.*' and '.+' is of course trading off the increase of > confusion that beginning ANTLR users already have over the whole issue of > greedy/nongreedy with the need for expert users to specify grammar rules > concisely. > > The problems with this tiny piece of the language, the fact that you raised > the issue rather than just doing it, and the fact that several people have > taken the time to bother about replying to your note, leads me to think that > the whole greedy/nongreedy distinction is important, and it therefore needs > to be raised to a higher level and not buried in the options. Also note that > it is an option that applies only to iterative subrules and therefore is an > integral part of iteration. My limited experience with ANTLR does not give > me any special authority to make the following recommendation, so take it as > a strong statement made to clearly raise the issue for your consideration: > > Every time we look at an iterative subrule, we need to be reminded whether > it is greedy or nongreedy; that is, we need separate operators for greedy > vs. nongreedy iteration. > > I suggest deprecating the current notation and using: > (...)** and (...)++ for greedy > (...)|* and (...)|+ for nongreedy > (or some other notation that indicates "stop me, quick") > > I know this is a change to the whole tradition of EBNF and regular > expressions, so your thoughts, flames, and groans will all be appreciated. > > George > 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 -~----------~----~----~----~------~----~------~--~---
