Hi Vincent! > Le 24 mai 2020 à 17:09, Vincent Imbimbo <[email protected]> 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!
