[antlr-interest] qbert

Ric Klaren klaren at cs.utwente.nl
Wed Jul 7 01:46:41 PDT 2004


On Mon, Jul 05, 2004 at 04:28:33AM -0000, atarisoldiers wrote:
> I have written ( assembled from other pieces really ) a grammar for d
> ( www.digitalmars.com/d/ ) , and have been slowly working down the
> nondeterminism rules.  One that is particurlary bad for me is
>
> d.g:24:38: warning:nondeterminism between alts 1 and 2 of block upon
> d.g:24:38:     k==1:EOF
> d.g:24:38:     k==2:EOF
>
> My parser hangs forever, and Im guessing this might be the rule ?

Might be might not be. Generate the parser/lexer with
-traceParser/-traceLexer and see what exactly happens. Some non-determinism
errors may not be bad (often antlr does the right thing just check the
generated code to see what it does).

What also helps is to cut down the grammar and then selectively add
features and see where non-determinism appears and work from there in
massaging it to a form where things don't go wrong. Note that in the
generated C++ files the contents of the lookahead bitmasks are dumped out
where they're defined (at the end of the file)

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  "I don't have anything against Java - it's the best damn implementation
              of UCSD Pascal ever released..." --- Larry Smith


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list