[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [REQUEST] Infinite recursion warning
From: |
Akim Demaille |
Subject: |
Re: [REQUEST] Infinite recursion warning |
Date: |
Tue, 10 Dec 2013 08:40:50 +0100 |
Le 10 déc. 2013 à 02:01, Valentin Tolmer <address@hidden> a écrit :
> Hello,
>
> In the following grammar, the only word recognized is NIL, because of
> an infinite recursion.
>
> exp:
> NIL
> | NIL list
>
> list:
> NIL list
>
> It would be nice if Bison could raise a warning in case of an infinite
> recursion.
Hi Valentin,
I suppose you mean that the message should be clearer?
$ cat foo.yy
%%
exp: "NIL" | "NIL" list
list: "NIL" list
$ LC_ALL=C bison foo.yy
foo.yy: warning: 1 nonterminal useless in grammar [-Wother]
foo.yy: warning: 2 rules useless in grammar [-Wother]
foo.yy:2.20-23: warning: nonterminal useless in grammar: list [-Wother]
exp: "NIL" | "NIL" list
^^^^
foo.yy:2.14-23: warning: rule useless in grammar [-Wother]
exp: "NIL" | "NIL" list
^^^^^^^^^^
foo.yy:3.7-16: warning: rule useless in grammar [-Wother]
list: "NIL" list
^^^^^^^^^^