Jim Idle wrote:
[snip]
> Even with backtracking, you still need to know something
> about LL(k) and parsing etc, and switching on backtrack mode
> will hide all your problems. It also means, as you have found
> out, that in the event of a syntax error, you cannot
> determine much about the location of your error.
>
> Basically, you will need to left factor at least some parts
> of your grammar. In this case, if you have something like:
>
> | ID
> | ID '(' expr ')'
> | ID something else
>
> and (probably more complicated than that is your issue), then
> look to do:
>
> | ID ( '(' expr
> | something
> )?
>
> and so on.
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. In fact, that section makes the argument
that one should *not* do the left-factoring manually, if for no other reason
than to maintain the readability of the grammar.
--
Gary R. Van Sickle
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
-~----------~----~----~----~------~----~------~--~---