[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yyparse being prototyped in y.tab.h causes problems.
From: |
Akim Demaille |
Subject: |
Re: yyparse being prototyped in y.tab.h causes problems. |
Date: |
Tue, 18 Aug 2015 21:40:20 +0200 |
> Le 18 août 2015 à 16:40, Kaz Kylheku <address@hidden> a écrit :
>
> On 18.08.2015 06:35, I blundered:
>> Hi Akim,
>> The example I gave is (to my best knowledge and effort)
>> POSIX-conforming Yacc code.
>
> Hi Akim, and everyone,
>
> Sorry for the above nonsense; of course it obviously is
> not due to the
>
> %pure-parser
> %parse-param{private_context *ctx}
>
> which is important to the issue!
>
> If you use an extension, then the yacc implementation
> can put whatever it wants in y.tab.h, of course;
> conformance has largely gone out the window.
>
> Though not standard, %pure-parser and %parse-param are implemented by other
> parser generators, though, like Berkeley Yacc. (Because reentrant parsing is
> a very
> important extension!)
>
> On the other hand, %code doesn't port to byacc:
>
> byacc: e - line 10 of "test.y", syntax error
> %code { abc }
> ^
Well, in that case I would include the forward declaration of your struct in
file that include your *.tab.h.
Or, given that the declaration of yyparse is issued quite late in the *.tab.h
file, couldn't you portably use %{...%} to forward declare your
private_context? The same mechanism as the one used to declare the symbols
needed by yystype.
- yyparse being prototyped in y.tab.h causes problems., Kaz Kylheku, 2015/08/14
- Re: yyparse being prototyped in y.tab.h causes problems., Akim Demaille, 2015/08/18
- Re: yyparse being prototyped in y.tab.h causes problems., Akim Demaille, 2015/08/18
- Re: yyparse being prototyped in y.tab.h causes problems., Kaz Kylheku, 2015/08/18
- Re: yyparse being prototyped in y.tab.h causes problems., Akim Demaille, 2015/08/19
- Re: yyparse being prototyped in y.tab.h causes problems., Kaz Kylheku, 2015/08/19
- Re: yyparse being prototyped in y.tab.h causes problems., Akim Demaille, 2015/08/19
- Re: yyparse being prototyped in y.tab.h causes problems., Kaz Kylheku, 2015/08/19