[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison parse-gram.y glr yacc
From: |
Paul Eggert |
Subject: |
Re: bison parse-gram.y glr yacc |
Date: |
Tue, 03 Jan 2006 14:37:38 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
twlevo <address@hidden> writes:
> multiple yacc glr statements
> parse-gram.y line 216
>
> %yacc
> %glr-parser
> %yacc
>
> %%
>
> start:
> ;
>
> %%
>
> this generates a yacc parser, no messages
> on the multiple yacc/glr parser statements.
2006-01-03 Paul Eggert <address@hidden>
* doc/bison.texinfo (Bison Options): Say more accurately what
--yacc does.
* src/parse-gram.y (rules_or_grammar_declaration): Don't complain
about declarations in the grammar when in Yacc mode, as POSIX does
not require a diagnostic when the grammar uses extensions.
Thanks. I think %yacc isn't supposed to mean "generate a yacc-style
parser", it's supposed to mean "behave more like yacc, if the input is
suitable for yacc". I installed this patch to clarify things:
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.170
diff -p -u -r1.170 bison.texinfo
--- doc/bison.texinfo 27 Dec 2005 15:42:44 -0000 1.170
+++ doc/bison.texinfo 3 Jan 2006 22:33:53 -0000
@@ -6677,13 +6677,14 @@ Print the version number of Bison and ex
@item --print-localedir
Print the name of the directory containing locale-dependent data.
address@hidden 1750
@item -y
@itemx --yacc
-Equivalent to @samp{-o y.tab.c}; the parser output file is called
+Act more like the traditional Yacc command. This can cause
+different diagnostics to be generated, and may change behavior in
+other minor ways. Most importantly, imitate Yacc's output
+file name conventions, so that the parser output file is called
@file{y.tab.c}, and the other outputs are called @file{y.output} and
address@hidden The purpose of this option is to imitate Yacc's output
-file name conventions. Thus, the following shell script can substitute
address@hidden Thus, the following shell script can substitute
for Yacc, and the Bison distribution contains such a script for
compatibility with @acronym{POSIX}:
@@ -6691,6 +6692,12 @@ compatibility with @acronym{POSIX}:
#! /bin/sh
bison -y "$@@"
@end example
+
+The @option{-y}/@option{--yacc} option is intended for use with
+traditional Yacc grammars. If your grammar uses a Bison extension
+like @samp{%glr-parser}, Bison might not be Yacc-compatible even if
+this option is specified.
+
@end table
@noindent
Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.67
diff -p -u -r1.67 parse-gram.y
--- src/parse-gram.y 3 Jan 2006 21:31:57 -0000 1.67
+++ src/parse-gram.y 3 Jan 2006 22:33:53 -0000
@@ -391,10 +391,6 @@ grammar:
rules_or_grammar_declaration:
rules
| grammar_declaration ";"
- {
- if (yacc_flag)
- complain_at (@$, _("POSIX forbids declarations in the grammar"));
- }
| error ";"
{
yyerrok;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: bison parse-gram.y glr yacc,
Paul Eggert <=