help-bison
[Top][All Lists]
Advanced

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

Re: Compilation error in ancient YACC code


From: Akim Demaille
Subject: Re: Compilation error in ancient YACC code
Date: Thu, 18 Apr 2019 06:54:28 +0200

Hi all,

> Le 15 avr. 2019 à 23:36, Hans Åberg <address@hidden> a écrit :
> 
> 
>> On 15 Apr 2019, at 22:37, Chris Bragg <address@hidden> wrote:
>> 
>> The YACC compiler generates only two errors. I suspect that the problem is a
>> minor one and that a small fix to the syntax will fix the problem. I am not
>> a YACC programmer - it is a complete mystery to me - and I was hoping a
>> posting of the yacc source code up to the point the errors occur and the
>> error report itself would allow someone to spot the problem. 
>> 
>> The YACC errors reported are follows:
>> 
>> calc.y:121.14: error: syntax error, unexpected =
>> 
>>          expr = { Expression = $1;};
>> 
>>             ^
>> 
>> calc.y:123.23: error: syntax error, unexpected =
>> 
>>          '('  expr ')' = { $$
> 
> Just take away that = before all actions {…}. Somebody else might enlighten 
> on the history of that.

Hans is right: that's an ancient feature of the original YACC.

Johnson notes (https://www.cs.utexas.edu/users/novak/yaccpaper.htm):

> Appendix D: Old Features Supported but not Encouraged 
> 
> 5. Actions may also have the form 
> 
>      =     { . . . } 
> and the curly braces can be dropped if the action is a single C statement. 


And POSIX (http://pubs.opengroup.org/onlinepubs/009604599/utilities/yacc.html)

> Some implementations recognize "={" as equivalent to '{' because it appears 
> in historical documentation. This construction was recognized and documented 
> as obsolete as long ago as 1978, in the referenced Yacc: Yet Another 
> Compiler-Compiler. This volume of IEEE Std 1003.1-2001 chose to leave it as 
> obsolete and omit it.

When we checked existing grammars, there was no evidence it would make sense to 
support it, it would just add entropy to the possible ways to define a grammar.

Besides, I'd like to keep '=' for other possible uses.

Cheers!


reply via email to

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