At 15:38 +0000 2005/03/01, Derek M Jones wrote:
>I suddenly realised that the token sequence:
>
>typedef x y;
>typedef i j;
>{
>
>is a syntactically valid function definition.
So it seems, but I have not been able to figure out which function. :-) The
problem is that C has some grammar difficulties.
>Bison is correct not to perform the reductions I was
>expecting. Until a {, or EOF, is seen it does not it does not
>know whether it is dealing with a function definition or a
>list of declarations.
I have some vague memory that somebody found (fairly late, in the 90'ies) a
grammar transformation to make C becoming LALR(1) (modulo the usual context
tweaks for "typedef", etc.) Then you would not need using the %glr option.
You might check the newsgroup comp.compilers and its FAQ, published there
monthly.
Hans Aberg
_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison