Parsing C++
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Parsing C++
I've been working on compilers for a little while now and I was wondering what do you guys find the best parsing technique to be when dealing with C++, if you have any experience. Please don't mention anything about parser generators
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Parsing C++
C++ is an absolutely horrendous language to parse. Personally I'd steer well clear. However, if you really do want to go there, then the clang project think (and I agree with them) that a hand-crafted recursive descent parser is the way to go. It means you can use a left-recursive grammar with all the lookahead you want, and allows for the context-sensitive checks that you require when parsing a non-context-free language like C++.
Re: Parsing C++
Regular expressions should be useful
Re: Parsing C++
Hardly - only for the lexing stage.viki wrote:Regular expressions should be useful