page 1  (42 pages)
2to next section

Karel the Robot

An Exercise in Implementing Language Processors with Eli

Peter Pfahler

Universit?at-GH Paderborn

Warburger Str. 100, D-33098 Paderborn

email: peter@uni-paderborn.de

Abstract: Karel is a simple robot. He lives in a room surrounded by walls. Karel's task consists

of picking up little things called beepers" that lie on the floor of his room. He can carry these

beepers with him and put them elsewhere. 1

Karel's tasks are specified in a simple robot programming language. This paper describes how

Karel's language can be implemented using the compiler construction environment Eli. The

implementation is presented in a step by step fashion following the typical task structure of a

language processor. An animation library is provided such that compiled robot programs can be

run and inspected visually. This paper is meant as a practical introduction to the construction of

language processors and a guide for the novice Eli user. This paper is not meant as a substitute

for the introductory and advanced documentation supplied with the Eli system.

1Karel the Robot was designed to be used in an introductory programming language course at the Stanford University. Karel's robot programming language was used in the first few weeks of this course instead of a real" programming language. Karel's world and Karel's control language are described in the book Karel the Robot" by Richard E. Pattis, John Wiley & Sons, 1981. In this paper an extended and syntactically modified programming language for Karel will be used.