help-bison
[Top][All Lists]
Advanced

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

Re: Help with shift/reduce conflict


From: Hans Aberg
Subject: Re: Help with shift/reduce conflict
Date: Tue, 29 Mar 2005 19:19:07 +0200

As Henrik Sorensen points out, you need to be more specific about the grammar you want to produce. Here is a suggestion though:

%token YYID
%%
expression:
    hier_id
  | method_call
  | paren_expr
;
paren_expr:
   '(' expression ')'
;
method_call:
    paren_expr '.' YYID paren_expr
;
hier_id :
    YYID
  | hier_id '.' YYID
;


At 12:23 +0200 2005/03/28, Henrik Sorensen wrote:
On Monday 28 March 2005 00.20, Soumitra Kumar wrote:
 1+3.YYID(7) has no meaning. But following is a valid
 expression:
 (YYID + YYID).YYID().YYID () + YYID() + YYID.YYID() +
 YYID.YYID
for this reduction to make any sense, you need to show more of your grammar.
What kind of operator is '.' in your grammar ?

Henrik


 -Soumitra.

 --- Henrik Sorensen <address@hidden> wrote:
 > can you tell a bit more about what your grammar
 > tries to achieve ?
 > from your very brief description, it sounds like you
 > can do this:
 >   1+3.YYID(7)
 > but what would this mean ?
 > Henrik
 >
 > On Sunday 27 March 2005 21.37, Soumitra Kumar wrote:
 > > %token YYID
 > > %%
 > > expression : hier_id
 > >
 > >         | method_call
 > >
 > >           /* unary and secondary expression
 >
 > follows.
 >
 > > */
 > >         ;
 > > method_call : expression '.' YYID '(' expression
 >
 > ')'
 >
 > >         ;
 > > hier_id : YYID
 > >
 > >         | hier_id '.' YYID
 > >
 > >         ;
 > >
 > > How to resolve the shift/reduce conflict? Please
 >
 > help.
 >
 > > -Soumitra.
 > >
 > >
 > >
 > > __________________________________
 > > Do you Yahoo!?
 > > Yahoo! Small Business - Try our new resources
 >
 > site!
 >
 > > http://smallbusiness.yahoo.com/resources/
 > >
 > >
 > > _______________________________________________
 > > address@hidden
 >
 > http://lists.gnu.org/mailman/listinfo/help-bison

 __________________________________
 Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site!
 http://smallbusiness.yahoo.com/resources/


 _______________________________________________
 address@hidden http://lists.gnu.org/mailman/listinfo/help-bison


_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison






reply via email to

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