[Top][All Lists]

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

Re: Compatibility with old YACC syntax

From: Paul Eggert
Subject: Re: Compatibility with old YACC syntax
Date: Fri, 18 Oct 2002 12:29:18 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 18 Oct 2002 16:41:37 +0200
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165215&repeatmerged=yes
> I have no idea what POSIX says about this syntax for defining rule:
>         a: b c = { action };

POSIX does not allow grammars that use that syntax, and says that the
syntax was documented as obsolete in 1978.  I have a copy of the
documentation printed in 1978 (there are some advantages to being a
pack rat :-), and it says:

   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

> PS/  Byacc accepts this grammar

Byacc can support the obsolete syntax as an extension, but portable
grammars must not use it.

Byacc support for the extension is buggy, as byacc misparses some C
statements if the curly braces are dropped.  This problem may help to
explain why the extension was not blessed by POSIX and is not
supported by Bison 1.75.

> PS2/ This reminds me of %<, %=, %> and other historical attrocious
> synonyms for %left, %nonassoc etc.  Does POSIX say something about
> them?

No.  However, all those features are mentioned as "Supported but not
Encouraged" in the above-quoted Appendix D.

I looked through the patches proposed by Fumitoshi UKAI
<address@hidden> for rdist as built by Bison 1.50.  All but one of
these patches are necessary to make the grammar conform to the POSIX
requirements, so they should be installed into rdist regardless of
whether rdist uses bison or byacc.  The exception is the GRAM_Y patch:
it works around a bug in Bison 1.50 that is fixed in Bison 1.75, so it
shouldn't need to be installed into rdist unless 1.50-compatibility is

reply via email to

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