Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mcvax!ukc!dcl-cs!craig
From: craig@comp.lancs.ac.uk (Craig Wylie)
Newsgroups: comp.unix.questions
Subject: bug in yacc   --  or is it a feature
Message-ID: <136@dcl-csvax.comp.lancs.ac.uk>
Date: Wed, 7-Jan-87 11:42:21 EST
Article-I.D.: dcl-csva.136
Posted: Wed Jan  7 11:42:21 1987
Date-Received: Thu, 8-Jan-87 02:41:21 EST
Reply-To: craig@comp.lancs.ac.uk (Craig Wylie)
Distribution: world
Organization: Department of Computing at Lancaster University, UK.
Lines: 54

Firstly if I'm repeating an old point then sorry.


The following yacc fragment is passed by yaqcc as correct but
would appear to include a syntax error.


%token IDENT COMMA FOR_ALL THERE_EXISTS 



%%
program		: ident_list quantifier

quantifier	: FOR_ALL 
		| THERE_EXISTS ident_list		
		: ident_list COMMA IDENT  /* error here  is ':' correct */
		| IDENT
%%


On closer examination it appears that yacc is treating this as


%token IDENT COMMA FOR_ALL THERE_EXISTS 



%%
program		: ident_list quantifier

quantifier	: FOR_ALL 
		| THERE_EXISTS

ident_list	: ident_list COMMA IDENT
		| IDENT
%%


now this would still seem to be wrong as the semi colons at the end of
each rule seem to be missing.  Adding them in produces the same parser
as when they are not included. Can't be a bug, must be a feature -- yet the
first example is not an inconcievable mistake made in the heat of the moment.


If there is anybody there who knows  --  bug or feature ?


Craig.
-- 
UUCP:	 ...!seismo!mcvax!ukc!dcl-cs!craig| Post: University of Lancaster,
DARPA:	 craig%lancs.comp@ucl-cs          |	  Department of Computing,
JANET:	 craig@uk.ac.lancs.comp           |	  Bailrigg, Lancaster, UK.
Phone:	 +44 524 65201 Ext. 4146   	  |	  LA1 4YR