Title: Programming Errors
Course: COP1000: Introduction to Programming > Section: Module Four

Introduction

A syntax error refers to an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language. For compiled languages syntax errors occur strictly at compile-time. A program will not compile until all syntax errors are corrected. (http://en.wikipedia.org/wiki/Syntax_error)

A logic error is a bug in a program that causes it to operate incorrectly, but not to terminate abnormally (or crash). A logic error produces unintended or undesired output or other behavior, although it may not immediately be recognized as such. Logic errors occur in both compiled and interpreted languages. Unlike a program with a syntax error, a program with a logic error is a valid program in the language, though it does not behave as intended. The only clue to the existence of logic errors is the production of wrong solutions. (http://en.wikipedia.org/wiki/Logic_error)

Run time is the time during which a program is running (executing), in contrast to other phases of a program's lifecycle such as compile time, link time, load time, etc. A run-time error is detected after or during the execution of a program, whereas a compile-time error is detected by the compiler before the program is ever executed. (http://en.wikipedia.org/wiki/Run_time_error)

Objectives

Upon completion of this module, the student will be able to:

Define the following: Run time, compile time, and logic errors
Identify the differences between the error types
Modify code to result in one of each type of error

Readings & Resources

Chapter 4: Guess the Number p. 48-50
Chapter 7: Using the Debugger p. 77-88
Appendix D: p. 407-410