A part of the compiler’s
job is to analyze the program code for “correctness”. If the meaning of a
program is correct, then a compiler cannot detect errors, but a compilercan
certainly detect errors in the form of a program. A compiler generally
reports following types of errors:
|
1. Syntax Errors: Occurs
when rules of a programming language are violated.
|
2. Semantics Errors: Occurs
when program statements are not meaningful.
|
3. Type Errors: Occurs when
data/value of unexpected type is passed or input.
|
4. Run-time Errors: Occurs
during the execution of a program.
|
5. Logical Errors: Causes a
program to produce incorrect output.
|
A compiler reports an error
byflashing an error message. An error message contains a line number and a
brief description of the error.
|
The second thing, a compiler does
is, it translates the corrected program text into object or assembly
instruction text understood by the computer. A compiler can report only the
syntax errors, semantics errors, and type errors. Run-time errors become know
at run-time and logical errors can be detected by tracing the program line by
line and checking its output.
|
Friday, August 19, 2016
Explain the role of acompiler in a programming language. What type of errors it generally reports?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment