






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







ROLL NO : 113 142 144 143 115
(^) In this phase of compilation, all possible errors made by the user are detected and reported to the user in form of error messages. This process of locating errors and reporting them to users is called the Error Handling process. (^) Detection and reporting of errors in the source program is the main function of the compiler. An error can occur at any phase of compilation. A good compiler must determine the line number of the program exactly, where the errors have occurred. (^) Error Handler = Error Detection + Error Report + Error Recovery (^) Error Handler is attached to every phase of Compiler Construction.
Detecti on Reporti ng Recover y
(^) Error is defined as a user action that causes an abnormal change or issue in a program. (^) Program submitted to compiler often have errors of various kinds. (^) Error Handler is present in Compiler Construction that is responsible for the detection of that kind of errors. (^) After Detection of Error, Error handler is responsible for reporting errors to user. (^) Error Handler also try to perform recovery strategies like panic mode recovery and phase level recovery in order to remove errors.
These errors occur when we violate the rules present in a syntax. The compile-time error indicates something that we need to fix before compiling the code. A compiler can easily detect these errors. It is the reason why we call them compile-time errors. Examples: (^) Terminator- missing semicolon. (^) Missing parenthesis. (^) Printing the overall value of a variable with no declaration.
These errors occur during the run-time program execution after a successful compilation. Division error is one of the most common errors (runtime). It occurs due to the division by zero. It is very difficult for a compiler to find out a runtime error because it cannot point out the exact line at which this particular error occurs. Examples: int a = 10; int b = 0; c = a / b;
These errors are detected during the syntax analysis phase. Typical syntax errors are: (^) Errors in structure (^) Missing operator (^) Misspelled keywords (^) Unbalanced parenthesis Example: int a ( Semicolon ‘;’ is Missing at the end of line ) ....... ....... a = b;
These errors are detected during the lexical analysis phase. Typical lexical errors are: (^) Exceeding length of identifier or numeric constants. (^) The appearance of illegal characters (^) Unmatched string Example: printf(“Hello World”);# ( At the end of line ‘#’ is illegal character )