This is the mail archive of the gcc-patches@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]

Re: ANSIfy cp/parser.c


Neil Booth wrote:
> 
> Neil Booth wrote:-
> 
> > Are you going to do that?
> >
> > I'll say again that I think a combined C and C++ parser is a mistake;
> > it penalizes C in so many ways.
> 
> Well, I don't seem to have much support in this belief.  However, I do
> believe it, and so I'm going to put the effort in and do it.
> 

I do believe it too.  I don't want to start a flame.  With my point of
view the combined parser is reflection of the belief that nobody is
interested in only C compiler and the most people is interested in
C/C++.  C++ started as a small extension of C and now C is a tiny part
of C++.  If this belief is not true, than the separate C front-end
results in more manageable and reliable C front-end.

> Since the new C++ parser went in, I've started to think I can see
> the light at the end of the tunnel to having really high quality C and
> C++ front ends (I don't believe we have those at present).
> 
> I got quite enthusiastic, and was so convinced that a separate C parser
> is the right thing that I started one last weekend.  My plan was/is as
> follows:
> 
> o Create a re-entrant recursive descent parser that looks somewhat
>   like cp/parser.c, in gcc/parser.c.

Do you use a compiler-compiler?  If you are writing it manually (usging
recursive functions), then how are you going to implement syntactic
error recovery?  What quality of the recovery do you can achieve this
way?

IMHO, you can not achieve a good syntactic error recover without an
explicit parser stack.  Also I think that the current computers permit
to implement a minimal cost error recovery now (actually the slowdown
occurs if a syntax error is found).  Such implementation needs a
backtracking to evaluate different alternatives of the recovery.

Also it is good to have C parser as an abstract component.  It could use
it not only for gcc (it might result in creation of another free C
compiler -- it is good for gcc to have another free c compiler as a
competitor).

You can ignore these ideas and questions - it is your implementation.  I
know how front-end implementation is difficult and boring. 

Vlad


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