Re: bison-2.7 and MacOS 10.13
> Le 8 sept. 2018 à 19:57, David Barto a écrit : > > Yes, thanks. I’ve not undertaken the change yet as we have a GA in a week. > > We were passing 3 args, so the same rules apply and it does make it easier to > use. Please, keep us posted! Your feedback could be useful if we write some documentation on how to modernize grammar files.
Re: bison-2.7 and MacOS 10.13
Yes, thanks. I’ve not undertaken the change yet as we have a GA in a week. We were passing 3 args, so the same rules apply and it does make it easier to use. David > On Sep 8, 2018, at 12:28 AM, Akim Demaille wrote: > > > >> Le 7 sept. 2018 à 14:29, David Barto a écrit : >> >> Our code is very very old and doesn’t support the newer non - YYPARSE >> defined version of bison. > > I guess you mean YYPARSE_PARAM here? > > It should not be too hard to migrate. > > > Previously, suppose you wanted to pass some struct named > parser_control. You needed to define the type, and define the macro > YYPARSE_PARAM: > >> %{ >> struct parser_control >> { >>int nastiness; >>int randomness; >> }; >> >> #define YYPARSE_PARAM pcontrol >> %} > > In your grammar actions, you had to cast to use the parse param > something like: > >> exp: "number" >> { >> $$ = $1 + ((struct parser_control *) pcontrol)->randomness; >> } > > and call your parser this way: > >> { >> struct parser_control foo; >> ... /* Store proper data in foo. */ >> res = yyparse ((void *) ); >> ... >> } > > To migrate to newer versions of Bison (perfectly valid with 2.7!): > >> %{ >> struct parser_control >> { >>int nastiness; >>int randomness; >> }; >> %} >> %parse-param {parser_control* pcontrol} > > In your actions: > >> exp: "number" >> { >> $$ = $1 + pcontrol->randomness; >> } > > and call your parser this way: > >> { >> struct parser_control foo; >> ... /* Store proper data in foo. */ >> res = yyparse (); >> ... >> } > > No more casts, not more limitations to a single param. > > Does this help? > David Barto ba...@cambridgesemantics.com Sometimes, my best code does nothing. Most of the rest of it has bugs.
Re: bison-2.7 and MacOS 10.13
> Le 7 sept. 2018 à 14:29, David Barto a écrit : > > Our code is very very old and doesn’t support the newer non - YYPARSE defined > version of bison. I guess you mean YYPARSE_PARAM here? It should not be too hard to migrate. Previously, suppose you wanted to pass some struct named parser_control. You needed to define the type, and define the macro YYPARSE_PARAM: > %{ > struct parser_control > { > int nastiness; > int randomness; > }; > > #define YYPARSE_PARAM pcontrol > %} In your grammar actions, you had to cast to use the parse param something like: > exp: "number" > { > $$ = $1 + ((struct parser_control *) pcontrol)->randomness; > } and call your parser this way: > { > struct parser_control foo; > ... /* Store proper data in foo. */ > res = yyparse ((void *) ); > ... > } To migrate to newer versions of Bison (perfectly valid with 2.7!): > %{ > struct parser_control > { > int nastiness; > int randomness; > }; > %} > %parse-param {parser_control* pcontrol} In your actions: > exp: "number" > { > $$ = $1 + pcontrol->randomness; > } and call your parser this way: > { > struct parser_control foo; > ... /* Store proper data in foo. */ > res = yyparse (); > ... > } No more casts, not more limitations to a single param. Does this help?
Re: bison-2.7 and MacOS 10.13
Our code is very very old and doesn’t support the newer non - YYPARSE defined version of bison. Since we can patch and carry the older version we do. Sadly. I’ve been pushing to update our code, however there is no support from on high to do it. David > On Sep 6, 2018, at 12:50 PM, Akim Demaille wrote: > > > >> Le 6 sept. 2018 à 15:22, David Barto a écrit : >> >> This is the issue. I’ll patch my older bison for __APPLE__ at the >> appropriate place and move along. > > Any reason for not moving to the more recent versions?
Re: bison-2.7 and MacOS 10.13
> Le 6 sept. 2018 à 15:22, David Barto a écrit : > > This is the issue. I’ll patch my older bison for __APPLE__ at the appropriate > place and move along. Any reason for not moving to the more recent versions?
Re: bison-2.7 and MacOS 10.13
This is the issue. I’ll patch my older bison for __APPLE__ at the appropriate place and move along. Thanks, David > On Sep 6, 2018, at 6:17 AM, Hans Åberg wrote: > > >> On 6 Sep 2018, at 12:43, David Barto wrote: >> >> For some reason I can’t get Bison-2.7 to run on MacOS 10.13. As I’ve posted >> in the past, I need the older version of bison (for the time being) for our >> older grammar files. >> >> Anyone understand why this is happening? The same version of bison running >> on 10.10 is just fine. > > It might be this issue. Older versions of Bison are unsupported. > > https://lists.gnu.org/archive/html/bug-bison/2017-09/msg2.html > > David Barto ba...@cambridgesemantics.com Sometimes, my best code does nothing. Most of the rest of it has bugs.
Re: bison-2.7 and MacOS 10.13
> On 6 Sep 2018, at 12:43, David Barto wrote: > > For some reason I can’t get Bison-2.7 to run on MacOS 10.13. As I’ve posted > in the past, I need the older version of bison (for the time being) for our > older grammar files. > > Anyone understand why this is happening? The same version of bison running on > 10.10 is just fine. It might be this issue. Older versions of Bison are unsupported. https://lists.gnu.org/archive/html/bug-bison/2017-09/msg2.html
Re: bison-2.7 and MacOS 10.13
Le 2018-09-06 12:43, David Barto a écrit : For some reason I can’t get Bison-2.7 to run on MacOS 10.13. As I’ve posted in the past, I need the older version of bison (for the time being) for our older grammar files. Anyone understand why this is happening? The same version of bison running on 10.10 is just fine. Have a look at this: http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00056.html