This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
namespace for types in stabs
- From: "Sigurd Lerstad" <sigurd at lerstad dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 11 Oct 2006 02:16:23 +0200
- Subject: 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