Start of task
End of task
Erroneous Program
move()
pick_beeber()
turn_left().
put_beeper()
move
|
|
When you first write a robot program, chances are that it will contain
some errors. There are four types of programming errors:
- Lexical Errors
- The program contains an instruction or keyword that Reeborg does not know.
These are akin to spelling errors in English.
- Syntactic Errors
- The rules for robot programming are violated, for example a
missing semicolon or a keyword at the wrong place.
These are akin to errors in grammar in English.
- Execution Errors
- Reeborg performs an error shutoff. This could happen because
- he runs into a wall
- a pick_beeper() command is executed
on a beeper-less corner
- a put_beeper() command is executed
with an empty pocket
- Intent (or Logic) Errors
- Reeborg performs a task which is different from his
assigned task.
Prior to running a program, it must be analyzed either by a compiler,
a program that translates the programs as written by us human programmers
(we call this form the source code) into the machine code form
that the computer can execute (we call this form the executable code)
or by an interpreter that translates the programs into some
internal form that is then directly executed by the interpreter.
(Python is typically used with an interpreter.)
This analysis phase, whether performed by a compiler or an interpreter,
we call compile-time.
Lexical and
Syntactic
errors are detected during the translation phase;
hence we often call these first two types of errors
compile-time errors.
Execution and
Intent (Logic)
errors occur when the program is running;
hence we often call these last two types of errors
run-time errors.
⇐
This program on the left contains all of these four errors. Can you
find and identify them?
(The errors.)
|