help-bison
[Top][All Lists]
Advanced

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

Re: shift/reduce and reduce/reduce conflicts


From: Hans Aberg
Subject: Re: shift/reduce and reduce/reduce conflicts
Date: Fri, 23 Jan 2004 19:59:10 +0100

At 15:52 -0200 2004/01/23, Valter G. Nogueira Jr. wrote:
>    I am developing a Visual Basic parser and since it  was my first
>non-tutorial based work I was pretty happy about it.   Since I was unaware
>of option -v I have got a  mess of conflicts.   Now, I have hundreds of
>conflicts which I have to  purge out my code.   I what make me asthonised
>gcc-java(v3.3.2)'s  parse.y has NONE conflicts.   Is that normal?   Does
>have any tips about vanishing these conflicts  away?

The best way is to use the --verbose option to check what is wrong.
Shift/reduce conflicts can often be removed using token precedences.
Reduce/reduce conflicts are often a sign of a serious error. See the Bison
manual.

>   May I run bison on a file without type checks and  actions just to
>check the grammar (right before to put C code in  it)?

Yes. Bison does nothing to the actions but to copy them over, and checks
the types to make sure they match. It is probably better to successively
develop the code though.

You can also turn on debugging mode and getting a writeout how the parser
stack evolves. Since you are writing a .y grammar for a known language, you
may check if there are some other such grammars to copy over and get input
from. Say if Gnu has one, or check in the comp.compilers newsgroup and its
FAQ published there monthly.

  Hans Aberg






reply via email to

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