[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lalr1.cc: use %printer in the syntax error messages
From: |
Akim Demaille |
Subject: |
Re: lalr1.cc: use %printer in the syntax error messages |
Date: |
Wed, 2 Sep 2009 13:37:21 +0200 |
Hi Joel,
Unwinding my todo stack :)
Le 27 août 09 à 09:11, Joel E. Denny a écrit :
(Oh, and by the way, the error messages presented here are
completely wrong.
I have no idea why they are, and I hoped that Joel's changes would
solve them,
but they do not: there are many many other tokens that can follow
the initial
float, arithmetical operators for instance.)
I've checked it out, and the problem is fixed by canonical LR.
I did expect this, but I didn't understand why I had the problem,
since the state lists in the *.output file correctly listed the
expected tokens (I'm referring to the lists of tokens to shift, those
for reduction, and a default reduction). Of course the problem was
the default reduction, which I had overlooked. The state in which the
error is actually diagnosed is reached a couple of default reductions
later, and in that state, indeed, the only valid token is EOF.
I played with canonical-lr, but it is way too expensive for me, both
in terms of size, and duration of compilation (maybe in a release
mode, but...). But toying with lr.default-reductions (still in lalr)
gives very good results.
I have 382 LR(0) states, and 12941 is canonical LR(1).
Here are the size of the parser files.
address@hidden ~/src/gnet/kernel $ ls -l _build/*/
ugrammar
.cc
12:40:05
-rw-r--r-- 1 akim akim 321287 Sep 2 12:10 _build/accepting/
ugrammar.cc
-rw-r--r-- 1 akim akim 170357 Sep 2 12:13 _build/all/ugrammar.cc
-rw-r--r-- 1 akim akim 8913314 Sep 2 11:52 _build/canonical-lr/
ugrammar.cc
-rw-r--r-- 1 akim akim 263165 Sep 2 12:06 _build/consistent/
ugrammar.cc
The syntax error on "1 1" behaves as expected with both accepting and
consistent (i.e., mute since there are too many possibilities ;).
So I will proceed with default-reductions=all on space-starving
targets (on which anyway I use simple error messages to get rid of the
tables), and "accepting" otherwise. The documentation for error-
verbose should probably promote the use of accepting/consistent.
- Re: lalr1.cc: use %printer in the syntax error messages,
Akim Demaille <=