This is the mail archive of the
mailing list for the GCC project.
Re: C Parser
"Paulo J. Matos" <email@example.com> writes:
> I was quite surprised to see that the C Parser was manually
> implemented and you didn't use any parser generator.
> I would be curious regarding this decision. I would think the
> development of a C parser would be an almost unsurmountable task and
> not very logic given the parser generators in existence today.
For a long time gcc used bison to generate the parser. Joseph Myers
rewrote it into a recursive descent parser a couple of years ago.
I'm sure Joseph could explain the reasons better, but some of the
problems with the bison parser were 1) it's hard to generate good
error messages at the right places; 2) C is not LALR(1) (at least, not
in a natural sense) because of the declaration syntax; 3) it made it a
lot easier to add OpenMP support.