3 May 00:27
Re: Multiple, different, %merge of a token sequence
Joel E. Denny <jdenny <at> ces.clemson.edu>
2006-05-02 22:27:33 GMT
2006-05-02 22:27:33 GMT
On Mon, 1 May 2006, Derek M Jones wrote: > I'm not sure if the following is a feature or a bug. > > There are four parses of the C input (x)*sizeof(y); > > (x) can be parsed as: > > 1) a cast of the expression *sizeof(y) to the type x (not > possible semantically, but this is syntax) > 2) the left operand of the multiplication operator * > > sizeof(y) can be parsed as: > > 1) the sizeof the expression (y) > 2) the sizeof the type y > > I put %merge on the production for sizeof (see below) and > was expecting the sizeof ambiguity to be 'fully' resolved. > > What happens is that the bison generated parser builds > all four parse stacks, resolves one pair of sizeof > ambiguities by calling sizeof_merge (leaving three stacks) > and then calls multiplicative_merge twice (leaving 1 stack). > > I think there should be two calls to sizeof_merge and one to > multiplicative_merge. I've confirmed this behavior with both Bison 2.1 and the latest CVS sources.(Continue reading)
RSS Feed