Re: Forcing multiple parse stacks to 'reduce'

2005-03-02 Thread Hans Aberg
On 2005/03/02 17:07, Derek M Jones at [EMAIL PROTECTED] wrote: >> 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.

Re: Forcing multiple parse stacks to 'reduce'

2005-03-02 Thread Derek M Jones
Hans, >>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 syntax does not permit an empty declaration. So x must be the declarator. The second typedef is simply a declaration and is n

Re: Forcing multiple parse stacks to 'reduce'

2005-03-01 Thread Hans Aberg
At 15:38 + 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 difficultie

Re: Forcing multiple parse stacks to 'reduce'

2005-03-01 Thread Hans Aberg
At 19:24 + 2005/02/28, Derek M Jones wrote: >>>I have written a parser for C that processes >>>a single statement or declaration at a time. >>>So after each statement/declaration yyparse >>>returns. >> >>Bison is clearly not built to handle such applications. The normal thing is >>to handle the

Re: Forcing multiple parse stacks to 'reduce'

2005-03-01 Thread Derek M Jones
Hans, >>In the case: >> >>typedef x, y; >>typedef i, j; I should have given the example as: typedef x y; typedef i j; >> >>the second typedef token is shifted onto all three stacks and >>subsequent tokens are processed like a declaration (which they >>do form part of)! So I don't get a parse o

Re: Forcing multiple parse stacks to 'reduce'

2005-03-01 Thread Laurence Finston
> Derek M Jones wrote: > > > >>I have written a parser for C that processes > > >>a single statement or declaration at a time. > > >>So after each statement/declaration yyparse > > >>returns. > > > I think you might be able to simplify matters by just using `statement' as your start symbol and cal

Re: Forcing multiple parse stacks to 'reduce'

2005-02-28 Thread Frank Heckenbach
Derek M Jones wrote: > >>I have written a parser for C that processes > >>a single statement or declaration at a time. > >>So after each statement/declaration yyparse > >>returns. > > > >Bison is clearly not built to handle such applications. The normal thing is > >to handle the whole language in

Re: Forcing multiple parse stacks to 'reduce'

2005-02-28 Thread Derek M Jones
Hans, >>I have written a parser for C that processes >>a single statement or declaration at a time. >>So after each statement/declaration yyparse >>returns. > >Bison is clearly not built to handle such applications. The normal thing is >to handle the whole language in one go. (How do you handle en

Re: Forcing multiple parse stacks to 'reduce'

2005-02-28 Thread Hans Aberg
At 17:03 + 2005/02/28, Derek M Jones wrote: >I have written a parser for C that processes >a single statement or declaration at a time. >So after each statement/declaration yyparse >returns. Bison is clearly not built to handle such applications. The normal thing is to handle the whole languag

Forcing multiple parse stacks to 'reduce'

2005-02-28 Thread Derek M Jones
All, I have written a parser for C that processes a single statement or declaration at a time. So after each statement/declaration yyparse returns. Originally I used various ad-hoc rules in yylex to figure out which was the last token of a statement/declaration and then returned a zero value as t