When a compiler attempts to compile source code there is a chance that it will be unable to because of syntax errors in the code. If there are any syntax errors in the code then it will not be able to compile. It is possible, although very unhelpful, for the compiler just to return false if it cannot compile. What would be much more useful is if the compiler actually reported what it thought was wrong. Consider the example below.

There is an error on line 4. IF statements should be followed by ELSE not by EOLSE. Clearly the coder has made a typo. Looking at the two responses it is not hard to see which one the developer would find more useful. The second message gives a clear indication on what the problem is and where the problem can be found. Although it does not say exactly what the problem is there is enough information there for the coder to work it out for themselves.


Compilers are not capable of second guessing what the developer meant. They do try to give as much information about what the problem may be it is not always accurate. The coder will need to use some other debugging tools to help them solve the problem.


Key information given by translator diagnostics are -

  • Type of error found
  • Line the error might be on
  • What the error could be and what the solution might be.

Note - the descriptions are a bit vague as the diagnostics a developer may get will not always be helpful or accurate.