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: Sun, 12 Feb 2006 19:42:27 -0500
User-agent: Mutt/1.5.9i

On Sun, Feb 12, 2006 at 12:02:10AM -0800, Paul Eggert wrote:
> Bob Rossi <address@hidden> writes:
> 
> > 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? 
> 
> Either would make sense.  My preference is to use the C preprocessor,
> and I think Akim's is to use m4.  If it's C++, many people don't
> want to use the preprocessor, due to fears of namespace pollution.

Well, I decided to use m4 over the C preprocessor. I initially started
with the C preprocessor but I soon realized the names I needed to
#define were also used locally in a bunch of functions. So I would have
had to modify the name of all those variables.

Now, using the m4 approach I change exactly the variables I want to
change. However, the downside is, I personally think it makes reading
the yyparse skeleton code harder.

Anyways, I ran into an m4 question that might be answered here. I have
this
  m4_define([b4_yystate],[b4_push_if([(pv->yystate)],yystate)])

and when I try to use b4_yystate() in this context
  ]b4_yyn()[ = yypact]b4_yystate()[;
it works fine. However, I need the C array brackets in the output so
however I try to write the line
  ]b4_yyn()[ = yypact[]b4_yystate()[];
or countless other variations, I just can't get it.

Any help would be greatly appreciated. I basically need the output to
look like
  yypack[yystate]; 
or in push mode
  yypack[(pv->yystate)];

Anyone know the answer to this?

Thanks,
Bob Rossi




reply via email to

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