[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Useless nonterminals - what and why?
From: |
Matthew Palmer |
Subject: |
Re: Useless nonterminals - what and why? |
Date: |
Tue, 21 Nov 2000 21:15:10 +1100 (EST) |
On 21 Nov 2000, Akim Demaille wrote:
> >>>>> "Matthew" == Matthew Palmer <address@hidden> writes:
>
> Matthew> OK, hacking on somebody else's bison file, and I have gotten
> Matthew> this message. Not real sure exactly what it means, beyond a
> Matthew> definition somebody gave that "A useless nonterminal is one
> Matthew> which doesn't produce any strings" or similar.
>
> That's a pretty theoretical definition, which in essence means this
> symbol is not reachable starting from the start symbol. Typically,
> it's not used in any rule.
>
> But Bison is usually quite good at error message: what exactly did it
> say?
That, and that only. "2 useless nonterminals and 3 unused rules". The
parse.output listed which rules and nonterminals it was, but nothing more.
> Your snippet has several flaws, but most probably due to the
> fact that you cut some other relevant parts. In particular I can't
> see any useless nonterminal here.
I thought I'd provided the flow of control, perhaps not. What fixed it,
AFAICT, was placing a required colon and port number after the hostname, as
in
http_proxy: host COLON_TOK PORTNUM_TOK
Although at some stage I think I added the single-element list thingy in
there, too, which may have fixed it. Basically I was just moving things
around trying to fix it, and stumblerd across the solution. I don't know
what exactly fixed it, because I didn't keep perfect records of everything I
did, but it now produces a valid parser, with no errors, and which produces
the required behaviour.
--
-----------------------------------------------------------------------
#include <disclaimer.h>
Matthew Palmer
address@hidden
Re: Useless nonterminals - what and why?, Akim Demaille, 2000/11/21
- Re: Useless nonterminals - what and why?,
Matthew Palmer <=