bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] style: decouple different uses of item_number


From: Akim Demaille
Subject: Re: [PATCH] style: decouple different uses of item_number
Date: Mon, 25 May 2020 07:27:32 +0200

Hi Vincent!

> Le 24 mai 2020 à 17:09, Vincent Imbimbo <address@hidden> a écrit :

> Hey Akim,
> This is something that gave me a lot of trouble when I started working on 
> Bison. item_number is used for elements of ritem as well as indices into 
> ritem which is fairly confusing. I've introduced item_index to represent 
> indices into ritem.

This is an excellent point.  Thanks for clarifying this!

> However, another solution would be to replace all of the instances of 
> item_index with *item_number, which is how some bison code (including cex) 
> already works. Basically, all incidents of ritem[i] would be replaced by *i.  
> This is a little risky as it would be really easy to miss one of these uses.


I have no strong opinion on the index vs. pointer issue.  I'd prefer that we 
have a single way to write things, if that doesn't make things actually harder 
to maintain/understand.  If you think moving to pointers only is doable, we can 
give it a try.

> * src/gram.h: introduce item_index for ritem indices.
> * src/closure.h, src/closure.c, src/ielr.c, src/lr0.c, src/print-graph.c, 
> src/state.h, src/state.h: Replace uses of item_number with item_index where 
> appropriate.

Installed.  Thanks!


reply via email to

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