This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

namespace for types in stabs


Hello,

I'm trying to make a C/C++ compiler.

I'm using flex and bison, and I have the book "modern compiler
implementation in C".

Some have commented that this book uses a non-traditional approach. Can
someone be more specific why it's untraditional?

In the phase to produce Abstract Syntax Tree (AST) from the source. C/C++
has a difficult case that has an amiguity

g * h

this can mean declare a variable pointer to g named h, or the variable g
multiplied with h;

In the above mentioned book, Appel first builds a syntax tree and then does
semantic analysis, i.e. type checking etc.
but it seems to me that because of the above ambiguity, ast building and
semantic analysis must be performed at the same time ?

C++ makes it even more difficult, consider this example:

class myclass
{
   int method()
   {
       g* h;
   }

   typedef int g;
}

Now, g is declared later in the source, which complicates things even more.

Does anyone have any pointers to me overcoming these two issues, also on the
light of using bison as the parser.

thanks,

--
Sigurd Lerstad


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]