• Program Debugging:
    • The process of finding and correcting errors (bugs) in a computer program is called program debugging.
    • Errors are inevitable during program development.

Syntax Errors:

  • Syntax errors are caused by invalid syntax, such as typing prnt instead of print.
  • Translators (compilers or interpreters) cannot understand instructions that contain syntax errors.
  • As a result, translators terminate when encountering syntax errors and indicate where in the program the problem occurred.
  • For example, a misspelling of a keyword or the omission of necessary punctuation marks can cause syntax errors.

Semantic Errors (Logic Errors)

  • Semantic errors, also known as logic errors, are caused by errors in program logic.
  • Translators cannot automatically detect these errors because they cannot understand the intent behind the computation.
  • For example, if a program calculates the average of three numbers using (num1 + num2 + num3) / 2.0 instead of dividing by 3, a translator would not recognize this mistake.
  • Computers only follow the given instructions and do not understand what the program is meant to do. Therefore, it is up to the programmer to detect and correct these errors.
Design a site like this with WordPress.com
Get started