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 00:03:57 +0100

At 13:56 -0700 2002/01/16, Scott Raney wrote:
>Hey, and that's an easy one.  Wait until you get to "the number of
>card", at which point the next token could be "button", at which point
>"number" is a property, or "buttons", at which point it's a function.

This sounds like a grammar like:

%token BUTTON, NUMBER

%%

numbered_buttons:
    NUMBER BUTTON
  | NUMBER buttons

buttons:
    BUTTON BUTTON
  | buttons BUTTON

%%

This is unambiguos in Bison, and admits different actions if one resp.
several buttons are used. (Or replace BUTTON with a suitable nonterminal.)

  Hans Aberg





reply via email to

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