7.2 Errors
Syntax errors
The errors that occur when translators are translating the program into machine code. These errors are always caused by stupid like spelling mistake, missing punctuation.
SYNTAX ERRORS WHEN COMPILING
The executable file will not be produced, and you will get a message that shows you why and where the error is.
SYNTAX ERRORS WHEN INTERPRETING
Because interpreter translate the program line by line, every line would occur until the interpreter meet a syntax mistake. It will stop immediately and throw out the error message.
The Difference is Complier doesn’t run the program but the Interpreter run all lines before the error line.
Logic errors
Logic errors mean that the program doesn’t what it is expected. For example, stuck in a while loop or print unexpected messages.
Run-time errors
The errors that when the machine code is running. A good example for this is divide by zero in operation.
Past Paper Question
