Mohammad Masood Masaeli <mm.masa...@gmail.com> writes: > Hello, I'm studying the code of GCC to now how does it work and some > other purposes... > Can anyone tell me how does its error recovery work? > I think it is something near to Panic method, but I'm not sure and no > documents exist about it!
What kind of error recovery are you asking about? The C and C++ frontends use recursive descent parsers. They implement error recovery using hand-written techniques like skipping to the end of a statement or block. The middle-end uses error_mark_node to indicate something which is erroneous, and it tries to avoid producing errors related to constructs which use that. This lets compilation continue, and perhaps generate useful additional errors, even after something goes wrong. Ian