[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lookahead correction for the C++ skeleton lalr1.cc
From: |
Akim Demaille |
Subject: |
Re: Lookahead correction for the C++ skeleton lalr1.cc |
Date: |
Sat, 13 Jul 2019 09:18:32 +0200 |
Hi Adrian,
There's a number of issues you should address before we install
your contribution:
- please separate the part about yacc.c
- stay within 76 columns, at most 79 occasionally
- space before parens
- use 'while (true)', not 'while (1)'
- enable all the warnings and make sure there are no errors
when running the test suite. See configure --enable-gcc-warnings,
see also https://travis-ci.org/akimd/bison/builds/558164975
- to avoid clashes between identifiers, prefer yytoken to token.
- end comments with a period.
- there's a couple of useless "#if YYDEBUG" around a "YYCDEBUG"
- braces alone on their line (there is a "if (yy_lac_established_) {")
- please match the style of the git commit messages.
- I'm very afraid of your type changes in the code of yysyntax_error
when !lac: you replaced int by yy_token_number. I can understand
the desire to do it, but it's too dangerous. For instance if you
have 256 tokens, yy_token_number is unsigned char, but yyntokens_
is 256. So things like
yy_token_number yyxend = yychecklim < yyntokens_ ? yychecklim :
yyntokens_;
are unlikely to behave properly.
I should probably add tests for 256 tokens in the test suite.
Because of hidden tokens such as eof, error, etc. the change
of type of yy_token_type is actually from 253 to 254 user tokens.
See script below.
I have prepared the test suite for your changes. Please see
the lac++ branch (on the official repo, and on GitHub too,
https://github.com/akimd/bison/tree/lac++).
Cheers!
$ for i in {251..255}; do
cat >input.$i.y <<EOF
%token $(for j in {0..$i}; do printf " a$j"; done)
%%
exp:
EOF
~bison/_build/9d/tests/bison -LC++ input.$i.y -o input.$i.cc
-Dparse.error=verbose
printf $i; grep 'token_number_type;' input.$i.cc
done
- Lookahead correction for the C++ skeleton lalr1.cc, Adrian Vogelsgesang, 2019/07/09
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Akim Demaille, 2019/07/09
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Adrian Vogelsgesang, 2019/07/09
- Re: Lookahead correction for the C++ skeleton lalr1.cc,
Akim Demaille <=
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Adrian Vogelsgesang, 2019/07/13
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Akim Demaille, 2019/07/14
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Akim Demaille, 2019/07/14
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Adrian Vogelsgesang, 2019/07/15
- Re: Lookahead correction for the C++ skeleton lalr1.cc, Akim Demaille, 2019/07/16