[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Identifying rule responsible for lookahead
From: |
Henrik Sorensen |
Subject: |
Re: Identifying rule responsible for lookahead |
Date: |
Mon, 28 Feb 2005 22:21:55 +0100 |
User-agent: |
KMail/1.7.2 |
Your grammar is ambigious.
It can be seen if you make the following transformation, factoring out the
null transition of opt_select, and you will see the shift/reduce conflict:
%token YYID YYDOT
%%
identifier : hier_id;
hier_id : simple_id
| hier_id YYDOT simple_id
| hier_id opt_select YYDOT simple_id
;
opt_select : '[' expr ']'
| opt_select '[' expr ']';
simple_id : YYID ;
expr : hier_id
| function_call;
function_call : expr YYDOT YYID
;
now you see the function_call is the same as the added hier_id YYDOT simple_id
hope this helps
Henrik
On Monday 28 February 2005 21.46, Soumitra Kumar wrote:
> %token YYID YYDOT
> %%
> identifier : hier_id
> ;
> hier_id : simple_id
> | hier_id opt_select YYDOT simple_id
> ;
> opt_select :
> | opt_select '[' expr ']'
> ;
>
> simple_id : YYID ;
> expr : hier_id
> | function_call
> ;
> function_call : expr YYDOT YYID
> ;