>Hmmm, how can you ever be sure, that the solution for the dangling else
>always will be correct, also in other ambiguous situations?
It is well-known to be correct, and is explained in compiler texts. It
is a very special case. In general, ambiguity is to be avoided unless
you know what you are doing, and probably even then. That said, I used
the technique seven times in a recent translator, and am confident
that it is correct. This was verified by use on about 1000 real
programs.
The SLK parser generator: http://home.earthlink.net/~slkpg/
[My rule of thumb has been that it's K to use disambiguation for
if/then/else and operator precedence in expressions. Anywhere else
you're likely to get into trouble. -John]