namespace for types in stabs

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

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux