[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: |
Mon, 20 Nov 2000 10:30:00 +1100 (EST) |
On Sat, 18 Nov 2000, Hans Aberg wrote:
> At 01.11 +1100 0-11-19, Matthew Palmer wrote:
> >OK, hacking on somebody else's bison file, and I have gotten this message.
> >Not real sure exactly what it means, beyond a definition somebody gave that
> >"A useless nonterminal is one which doesn't produce any strings" or similar.
>
> I can just make a quick guess until you get a reply from the real
> experts... :-)
>
> >http_proxy_list: http_proxy_list http_proxy { ... }
>
> But it seems me if you just have such a rule and nothing else, you have
> nothing to start up the pattern <http_proxy_list>: Think of it as a loop
> which needs some kind of initialization. It could be the empty string
> http_proxy_list: http_proxy_list http_proxy { ... }
> | { ... }
> or the well known <foo_bar> variable
> http_proxy_list: http_proxy_list http_proxy { ... }
> | foo_bar { ... }
Interesting. Even though I'll get a hit with http_proxy, I still need the
empty list?
I seem to have fixed it now, anyway. Made it a requirement to have a comma
between entries, as in
http_proxy_list: http_proxy_list COMMA_TOK http_proxy
and then make the opt_port required, as in
http_proxy: host COLON_TOK PORTNUM_TOK
and it compiles and parses fine.
I think it's because there would be circumstances where it couldn't work out
when it was actually parsing a http_proxy entry or something else, and the
poor dear might get confused... <g>
--
-----------------------------------------------------------------------
#include <disclaimer.h>
Matthew Palmer
address@hidden
Re: Useless nonterminals - what and why?, Akim Demaille, 2000/11/21