Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #386

Re: How detect cycle in grammar ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.glorb.com!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end
From Gene <gene.ressler@gmail.com>
Newsgroups comp.compilers
Subject Re: How detect cycle in grammar ?
Date Wed, 7 Dec 2011 06:29:33 -0800 (PST)
Organization Compilers Central
Lines 23
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <11-12-014@comp.compilers> (permalink)
References <11-11-041@comp.compilers> <11-11-045@comp.compilers> <11-11-050@comp.compilers> <11-11-057@comp.compilers> <11-11-066@comp.compilers>
NNTP-Posting-Host news.iecc.com
X-Trace leila.iecc.com 1323609025 76560 64.57.183.58 (11 Dec 2011 13:10:25 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Sun, 11 Dec 2011 13:10:25 +0000 (UTC)
Keywords parse, theory
Posted-Date 11 Dec 2011 08:10:25 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref x330-a1.tempe.blueboxinc.net comp.compilers:386

Show key headers only | View raw


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).

Back to comp.compilers | Previous | NextPrevious in thread | Find similar


Thread

How detect cycle in grammar ? Borneq <a.moderacja@gmail.com> - 2011-11-20 08:48 -0800
  Re: How detect cycle in grammar ? Hans Aberg <haberg-news@telia.com> - 2011-11-21 18:14 +0100
  Re: How detect cycle in grammar ? Gene <gene.ressler@gmail.com> - 2011-11-21 10:20 -0800
    Re: How detect cycle in grammar ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-22 15:20 +0000
      Re: How detect cycle in grammar ? Quinn Tyler Jackson <quinn_jackson2004@yahoo.ca> - 2011-11-25 22:28 -0800
      Re: How detect cycle in grammar ? Gene <gene.ressler@gmail.com> - 2011-11-27 10:18 -0800
    Re: How detect cycle in grammar ? Borneq <a.moderacja@gmail.com> - 2011-11-23 12:56 -0800
    Re: How detect cycle in grammar ? Borneq <a.moderacja@gmail.com> - 2011-11-24 09:24 -0800
      Re: How detect cycle in grammar ? Gene <gene.ressler@gmail.com> - 2011-11-27 10:27 -0800
        Re: How detect cycle in grammar ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-28 16:46 +0000
          Re: How detect cycle in grammar ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-11-29 07:31 +0000
            Re: How detect cycle in grammar ? Paul B Mann <paul@paulbmann.com> - 2011-12-01 02:46 -0800
              Re: How detect cycle in grammar ? Quinn Tyler Jackson <quinn_jackson2004@yahoo.ca> - 2011-12-02 09:20 -0800
          Re: How detect cycle in grammar ? Gene <gene.ressler@gmail.com> - 2011-12-07 06:29 -0800

csiph-web