The problem isn't exactly infinite recursion, at least not as far
as Bison is concerned. The error/warning messages are indeed
suboptimal. Bison reports a constellation of symbols/rules as
being "useless."
When most people (myself included) see this message, they usually
assume that this means
In my own parser generator tinkering (where I care greatly about
explanations), I would say:
'list' is a nonterminal that never terminates.
and link to a longer explanation of that concept.
This is probably the most succinct diagnostic,
since the problem is not what any of the 'list'
rules does
Le 15 déc. 2013 à 01:31, Arthur Schwarz a écrit :
> exp:NIL
>| NIL list
>
> list:NIL list
>
> I won't address the issue of messaging (unqualified and this is an issue best
> addressed by the development team) but I will explore the grammar.
Valentin is well aware of the fact that the gra
exp:NIL
| NIL list
list:NIL list
I won't address the issue of messaging (unqualified and this is an issue best
addressed by the development team) but I will explore the grammar.
In LL (top-down, recursive descent) parser generators, the correct way to
represent a list of items is:
list : t
> 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-
Le 10 déc. 2013 à 02:01, Valentin Tolmer 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
> recursi
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.
Thanks!
--
Valentin Tolmer
___