bug-bison
[Top][All Lists]
Advanced

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

Re: Namespace-prefix


From: Hans Aberg
Subject: Re: Namespace-prefix
Date: Tue, 15 Oct 2002 23:43:45 +0200

At 11:40 -0700 2002/10/15, Paul Eggert wrote:
>Sorry, I don't use C++ so you're going to have to provide more context
>for me.  What is the difference between a namespace prefix and a name
>prefix?

If one is using a C++ namespace, it has a special syntax, for example:

namespace bison {

  class parser {
  public:
    void parse();
  };

} // namespace bison

Then parse () gets actual full name bison::parser::parse(), with some
semantic meaning that "bison" is a namespace and "parser" is a class.

One will surely want to have this construction, but namespace can be quite
large, so if bison would use two parser for some reason, one might be named
grammar_parser and the other skeleton_parser. It does not fit the C++
paradigm to put them outside the namespace, nor would one want them to have
the same name inside it.

>Is there some more general way to address the issue, whatever it is?
>I would rather not add one name-mangling option for C++, another
>name-mangling option for ML, etc.

Does it really matter with the new M4 approach?

There is already some such C++ stuff in Bison, in muscle_tab.c, line 61:
  /* C++ macros.  */
  muscle_insert ("name", "Parser");

-- I did not have any use of that particular macro, so that one could be
deleted.

-- The other thing that do need is the two pre-/post-prologues not tied to
%union.

In general, I think that the components that earlier has been merged
together in groups like that will have to successively be broken down into
components in order to make it possible to write for several output
languages.

  Hans Aberg






reply via email to

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