[antlr-interest] Non-determinism

Nitin Gupta nitin_bitkmc at yahoo.com
Thu Feb 12 21:21:35 PST 2004


Hi Nijesh
Non Determinism exists when the parser generator is unable to identify which production to use uniquely. 
Suppose there are two productions in ur grammer which start with the same token, now while parsing ur file, if the parser encounters this token, then it will not be able to identify the production to be used.
If then else is a classic example of this nondeterminism.
Sometimes it can be solved by just increasing the lookahead value (k). But this increases the parsing time exponentially and does not always work.
Or you can set the greedy option true, in which case the parser looks for the largest possible match.
Otherwise you have to break these productions and re write them to avoid non determinism.
I hope it helps.
 
Nitin Gupta
 
 
 


 


Hi !!
while generating .java file, antlr is showing some warnings related to
non-determinism .Can anybody explain what it is exactly ?
thanks in advance.
Rg
Nijesh



Yahoo! Groups Links






---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040212/1e57e381/attachment.html


More information about the antlr-interest mailing list