Hi Simon, > Le 28 févr. 2022 à 20:28, Simon Scatton <simon.scat...@outlook.fr> a écrit : > > Hello, > > I've been experiencing with bison's lr.type option yesterday and I found > a strange thing. > > When changing the lr.type option in my bison file I made a typo and I > encountered this error message : > > test.yy:1.1-21: error: invalid value for %define variable ‘lr.type’: ‘lalrr’ > 1 | %define lr.type ielrr > | ^~~~~~~~~~~~~~~~~~~~~ > test.yy:1.1-21: note: accepted value: ‘lr(0)’ > test.yy:1.1-21: note: accepted value: ‘lalr’ > test.yy:1.1-21: note: accepted value: ‘ielr’ > test.yy:1.1-21: note: accepted value: ‘canonical-lr’ > > > Then I saw that there was a mention of lr(0) as a valid value for this > field and when trying to use it I got this error message : > > test.yy:1.19: error: invalid character: ‘(’ > 1 | %define lr.type lr(0) > | ^ > test.yy:1.21: error: invalid character: ‘)’ > 1 | %define lr.type lr(0) > | ^ > test.yy:7.3-8.0: error: unexpected epilogue > 7 | %% > | ^ > test.yy:1.1-18: error: invalid value for %define variable ‘lr.type’: ‘lr’ > 1 | %define lr.type lr(0) > | ^~~~~~~~~~~~~~~~~~ > test.yy:1.1-18: note: accepted value: ‘lr(0)’ > test.yy:1.1-18: note: accepted value: ‘lalr’ > test.yy:1.1-18: note: accepted value: ‘ielr’ > test.yy:1.1-18: note: accepted value: ‘canonical-lr’ > > I am doing something wrong here to define that option ?
While I was conducting significant changes in the generation of the LR(0) automaton, I was annoyed by the fact that the LR(0) automaton is quite "hidden" and hard to get. I needed it to debug. So I have added the value lr(0) to the option, but did not document it on purpose: it stops the automaton generation at the LR(0) stage, but there is no support for this in the skeletons. And the routines we use to parse option arguments are too honest: they do show all the possible values. In other words, you found something which is intended to stay hidden, as a helping tool for Bison developers, but not something meant for Bison users. Cheers!