Re: How detect cycle in grammar ?

Gene <gene.ressler@gmail.com>
Wed, 7 Dec 2011 06:29:33 -0800 (PST)

          From comp.compilers

Related articles
[7 earlier articles]
Re: How detect cycle in grammar ? gene.ressler@gmail.com (Gene) (2011-11-27)
Re: How detect cycle in grammar ? gene.ressler@gmail.com (Gene) (2011-11-27)
Re: How detect cycle in grammar ? anton@mips.complang.tuwien.ac.at (2011-11-28)
Re: How detect cycle in grammar ? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-11-29)
Re: How detect cycle in grammar ? paul@paulbmann.com (Paul B Mann) (2011-12-01)
Re: How detect cycle in grammar ? quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2011-12-02)
Re: How detect cycle in grammar ? gene.ressler@gmail.com (Gene) (2011-12-07)
| List of all articles for this month |

From: Gene <gene.ressler@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 7 Dec 2011 06:29:33 -0800 (PST)
Organization: Compilers Central
References: 11-11-041 11-11-045 11-11-050 11-11-057 11-11-066
Keywords: parse, theory
Posted-Date: 11 Dec 2011 08:10:25 EST

On Nov 28, 11:46 am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
wrote:
> Gene <gene.ress...@gmail.com> writes:
> >It's also worth noting that any grammar with A->A in it is ambiguous
> >in a way that should cause LR table generation to fail. How would a
> >parser know how many times to reduce A->A?
>
> S -> A|B
> A -> A
> B -> t
>
> This grammar can derive only the word "t", and only in one way. I see
> no ambiguity; no word can be derived in two ways in this grammar.
>
> As for warning about these useless cycles, sure, they may indicate a
> programming mistake, so better warn about them. I still don't see
> that they are a problem as far as their meaning is concerned, nor
> wrt. implementability in general. Apparently the Bison implementors
> thought so, too, or Bison would produce an error, not a warning.


We are really down in the weeds. I should have said any reduced
grammar (with useless non-terminals already removed).



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.