bison-patches
[Top][All Lists]
Advanced

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

Re: push parser


From: Bob Rossi
Subject: Re: push parser
Date: Sat, 11 Feb 2006 21:47:03 -0500
User-agent: Mutt/1.5.9i

On Thu, Feb 09, 2006 at 09:50:17AM +0100, Akim Demaille wrote:
> >>> "Paul" == Paul Eggert <address@hidden> writes:
> 
>  > Bob Rossi <address@hidden> writes:
>  >> Hmm, just so I don't misunderstand you. Are you saying you wouldn't mind
>  >> if bison would always generate a pure reentrant parser? or only when you
>  >> are using the asynchronous push parser mode?
> 
>  > The latter.
> 
> To make things even clearer, it is easy to implement a non-pure,
> non-reentrant pull parser on top of a pure reentrant push parser.
> And backward compatibility is a must have for yacc.c (in pull mode).

Hi All,

Things are moving slow, as I assumed they would. However, I would like
to keep the list up to speed with my work, so that it can be directed
as seen appropriate.

The main struct declared by Odd to implement a push parser was defined
by wrapping all of these variables in yacc.c:

  ]b4_pure_if([b4_declare_parser_variables])[
  int yystate;
  int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  ....

like so:

  struct yypvars
  {
    ]b4_pure_if([b4_declare_parser_variables])[
    int yystate;
    int yyn;
    int yyresult;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;
    ....
  }

Basically, everywhere 'yystate' is used, I will need to replace it with
'pv->yystate'. This is assuming the current parser instance that bison
is using is called pv.

So, as my first question, would it make sense to write a m4 macro that
either generates yystate when in normal bison mode, and pv->yystate when
in m4 bison mode? 

or would it be better to use the C++ preprocessor to do this? 
  #ifdef PUSH_PARSER
  #define YYSTATE pv->yystate
  #else
  #define YYSTATE yystate
  #endif

Thanks,
Bob Rossi




reply via email to

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