help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forcing multiple parse stacks to 'reduce'


From: Hans Aberg
Subject: Re: Forcing multiple parse stacks to 'reduce'
Date: Tue, 01 Mar 2005 20:02:40 +0100
User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]