help-bison
[Top][All Lists]
Advanced

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

Re: How to change default outcome of shift/reduce conflict?


From: Hans Aberg
Subject: Re: How to change default outcome of shift/reduce conflict?
Date: Fri, 18 Jan 2002 13:32:01 +0100

At 15:10 -0700 2002/01/17, Scott Raney wrote:
>That's my point: the required lookahead in the case of "number" is 3,
>not 1.

All LR(n) grammars, n > 1, can be rewritten as LR(1) (to a grammar
producing the same language) and even to LR(0) if each sentence is followed
by an end marker, see Robin Hunter, "Compilers", sec. 5.2. And all grammars
that can be parsed by a predictive parser can be parsed by LR(n)
techniques, see Aho et al, "Compilers...", sec. 4.7.

So assuming those conditions, you should have a language describable by a
LR(1) grammar. Then the question is whether it can be cut down to LALR(1),
which is what Bison uses.

  Hans Aberg
                  * Email: Hans Aberg <mailto:address@hidden>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>





reply via email to

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