[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read an understand the bison report file ?
From: |
Hans Aberg |
Subject: |
Re: How to read an understand the bison report file ? |
Date: |
Tue, 26 Jun 2012 22:58:34 +0200 |
On 26 Jun 2012, at 13:23, Timothy Madden wrote:
> I wrote a grammar file for an approximation of the php language (with the
> purpose of adding braces to single-statements under if, for, while, but that
> is not included yet), that simply outputs the found tokens back to an output
> stream.
If you want to write a grammar for a known language, there is a good chance
somebody already has done so. You might inquiry in the Usenet newsgroup
comp.compilers.
> My problem is I got like 233 shift/reduce conflicts (and 18 reduce/reduce
> conflicts) and I do not really understand them. But searching the internet
> shows most people have like 3 or 4 of them ... what did I do ?
>
> Is there a way for me to understand that report file bison outputs ? I looked
> a lot through it, but I can not get where the conflicts are comming from. It
> does says something about the first rules, describing whitespace, which I
> want to preserve as significant part of the grammar.
>
> I have CenOS 6.2 64-bit (up-to-date), GNU bison 2.4.1 64-bit.
> The grammar and report files are attached.
Bison token preferences act on the tokens immediately before and after the
parsing position '.' of the conflicting shift/reduce rules. So you might try to
get rid some of them that way, by setting token precedences.
Reduce/reduce conflicts may call for the grammar to be rewritten - write a
grammar for a more general language without them, and cut it down in the
semantic actions. Or you may try to use the GLR parser - see the manual for an
example, from parsing C++ I recall. It is possible to use the first method for
that too, so it is part a matter of taste which method to choose.
Hans
- How to read an understand the bison report file ?, Timothy Madden, 2012/06/26
- Re: How to read an understand the bison report file ?,
Hans Aberg <=
- Re: How to read an understand the bison report file ?, Akim Demaille, 2012/06/27
- Re: How to read an understand the bison report file ?, Akim Demaille, 2012/06/27
- Re: How to read an understand the bison report file ?, Timothy Madden, 2012/06/27
- Re: How to read an understand the bison report file ?, Vincent Zweije, 2012/06/27
- Re: How to read an understand the bison report file ?, Hans Aberg, 2012/06/27
- Re: How to read an understand the bison report file ?, Akim Demaille, 2012/06/28
- Re: How to read an understand the bison report file ?, Timothy Madden, 2012/06/28
- Re: How to read an understand the bison report file ?, Akim Demaille, 2012/06/28