Panic-mode recovery: Skip ahead to the next integer and then continue. Example: Consider the erroneous expression- (1 + + 2) + 3. This is adequate when the presence of multiple errors in the same statement is rare. The parser discards the input symbol one at a time until one of the designated (like end, semicolon) set of synchronizing tokens (are typically the statement or expression terminators) is found. This is the easiest way of error-recovery and also, it prevents the parser from developing infinite loops while recovering error. Now, let’s try to understand the recovery of errors in every phase of the compiler. There are some common recovery methods that are as follows. The basic requirement for the compiler is to simply stop and issue a message, and cease compilation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |