www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/10/11:52:31

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199706101552.AA138297935@typhoon.rose.hp.com>
Subject: Re: clash when compiling YACC file
To: tron DOT thomas AT sierra DOT com (Tron Thomas)
Date: Tue, 10 Jun 1997 8:52:14 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <339C9FC9.5AF7@sierra.com>; from "Tron Thomas" at Jun 09, 97 5:28 pm

> I am using Bison version 1.25 for MS-DOS to compile a YACC file.
> 
> When I run Bison on the file I get the following error message:
> 
> error: type clash (`' `text') on default action
> 
> I am not very familiar with Bison, and this error message has me
> confused.  Can someone please enlighten me one what the problem is and
> how to fix it?

This means you have provided a rule with no code associated with it.
Yacc will automatically generate the code 

$$= $1 

for you.  If $1 and $$ are not compatible, then you get the error message
you see.  To work around it put empty braces

{}

After the rule.

IE

some_string_type : some_char_token

needs to be changed to 

some_string_type : some_char_token {}

HTH

Andrew

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019