[Top][All Lists]

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

Re: glr.c cleanup

From: Hans Aberg
Subject: Re: glr.c cleanup
Date: Thu, 8 Dec 2005 11:04:12 +0100

On 8 Dec 2005, at 08:58, Joel E. Denny wrote:

Under C++, I think one should have:

namespace yy {

   class stack;

This corresponds to yyGLRStack. yystack is *the* instance, and it's local
to yyparse().  For any function that needs a pointer to that yystack,
yystackp is the parameter name.  For C, none of these are in the user
interface.  Does this make sense?

I think that under C, you have implemented your own stacks, which people are not expected to change, and therefore they need not be in the user interface. Under C++, it is different.

So in order to keep multilingual similarity, that suggests just naming it "yystack", without a "p". Names with a "p" added should then be reserved
for C implementation variables, but not in the interface.

I don't believe yystack is part of the interface.

Under C++, one would be able to choose stack, with at least two standard
choices: std::vector, and std::deque.

I see.  I need to study this thing some day.

A question that might coming up is how to sync the two C and C++ implementations. At least they should be easily readable for comparison, for easy development. One canm think of ways of going further, to autmate it, though that is alter question.

  Hans Aberg

reply via email to

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