bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation fault


From: Hans Aberg
Subject: Re: Segmentation fault
Date: Tue, 31 Aug 2004 20:09:01 +0200

At 00:38 +0100 2004/08/30, Arne 'Timwi' Heizmann wrote:
>This list needs a Reply-To header! :-p I sent this e-mail straight after
>I sent the first one, without realising I only sent it to myself!

Most email editors have a "reply-to-all" option. Use that one.

At 08:19 +0200 2004/08/30, Tim Van Holder wrote:

>>%token X
>>%start startsymbol
>>%%
>>startsymbol       : /* empty */
>>unusednonterminal : X
>>%%
...
> - each rule needs to end with a semicolon.

Bison 1.75 says:
parse error, unexpected ":", expecting ";" or "|"

But earlier version supported rules without a ";". I do not know if the
feature has been taken away permanently.

My own opinion is that it is best to require a semicolon: It just becomes
difficult to implement it, otherwise. If  POSIX requires semicolons for
Yacc, then I think it should be required in Bison.

Adding semicolons:
%token X
%start startsymbol
%%
startsymbol       : /* empty */ ;
unusednonterminal : X ;
%%
Bison 1.75 gives diagnostics:
test.y: warning: 1 useless nonterminal and 1 useless rule
test.y:5.1-17: warning: useless nonterminal: unusednonterminal
test.y:5.19-21: warning: useless rule: unusednonterminal: X

So, no segfault. In fact, Bison should generate a parser, based on that
faulty grammar, by merely neglecting the parts that cannot be used. Those
are warnings, not errors.

It may be a bug in the Bison 1.875x you happen to use, or a problem with
your installation.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]