Error Detection and Recovery in Compiler




Error encountered in different phases

Classification of errors

Classification of errors

Lexical phase errors

  • These errors are detected during the lexical analysis phase.
Lexical Phase Errors

Lexical Phase Errors

Panic mode Error Recovery:

  • In this Method, Successive characters from the input are removed one at a time until a designated set of synchronizing tokens is found.
  • Synchronizing tokens are delimiters such as ; or }
Panic Mode Recovery

Panic Mode Recovery

Syntactic phase errors

  • These errors are detected during the syntax analysis phase.
Syntactic Phase Errors

Syntactic Phase Errors

Statement mode Error Recovery:

  • In this Method, when a parser encounters an error, it performs necessary correction on remaining input so that the rest of input statement allow the parser to parse ahead.
Statement mode error recovery

Statement mode error recovery

Semantic errors

  • These errors are detected during the semantic analysis phase.
Statement mode error recovery

Semantic Errors



Related Searches to Error Detection and Recovery in Compiler