[cfe-dev] Lookahead vs. Tentative Parsing

John Freeman jfreeman at cse.tamu.edu
Tue Jul 5 20:56:44 PDT 2011


Since C++ lambda expressions and Objective-C message expressions can 
each start with the same two tokens (l_square followed by identifier), 
it can take a lookahead of three tokens to differentiate the two cases. 
There are other instances, especially in C++, where further lookahead, 
or even semantic analysis, may be required. In the case above, I guess 
that lookahead is enough to decide which parsing path to take, but in 
general, what are the criteria for deciding to use lookahead vs. 
tentative parsing?

With tentative parsing, are diagnostics suppressed until the parsing has 
been committed?

- John



More information about the cfe-dev mailing list