Karel (programming language)

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
Karel the Robot
Paradigm object-oriented
Appeared in 1981
Designed by Richard E. Pattis
Dialects Some localized language variants
Influenced by Pascal
Influenced Karel++

Karel is an educational programming language for neophytes, created by Richard E. Pattis in his book Karel The Robot: A Gentle Introduction to the Art of Programming. Pattis used the language in his courses at Stanford University. The language is named after Karel Čapek, a Czech writer who introduced the word robot.

Contents

Principles

A program in Karel is used to control a simple robot (named Karel, of course) that lives in an environment consisting of a grid of streets (left-right) and avenues (up-down). Karel understands five basic instructions: move (Karel moves by one square in the direction he is facing), turnleft (Karel turns 90 ° left), putbeeper (Karel puts a beeper on the square he is standing at), pickbeeper (Karel lifts a beeper off the square he is standing at), and turnoff (Karel switches himself off, the program ends). A programmer can create additional instructions by defining them in terms of those five basic, and using control flow statements if, while, iterate.

Example

The following is a simple example of Karel syntax (a ";" indicates that another instruction follows).

BEGINNING-OF-PROGRAM
 
 DEFINE turnright AS
 BEGIN
   turnleft;
   turnleft;
   turnleft
 END
 
 BEGINNING-OF-EXECUTION
   ITERATE 3 TIMES
     turnright;
     move;
     turnoff
 END-OF-EXECUTION
 
END-OF-PROGRAM

Variants and descendants

The language has inspired the development of various clones and similar educational languages. As the language is intended for beginners, localized variants exist in some languages, notably Czech (the programming language was quite popular in Czechoslovakia). The Slovak version, called Robot Karol++, contains further enhancements and it has been itself translated to English, German and Czech.

The principles of Karel were updated to the object-oriented programming paradigm in a new programming language called Karel++. Karel++ is conceptually based on Karel, but uses a completely new syntax, similar to Java.

A language called Karel is a proprietary language used to program the robots of FANUC Robotics. However, FANUC Karel is derived from the Pascal programming language1

A REALbasic implementation, rbKarel [1], provides the basic Karel commands within an RBScript environment with BASIC syntax being used for loops and conditionals. This teaching project provides a cross-platform GUI for Karel experiments including single-stepping and spoken output.

See also

References

  • Richard E. Pattis. Karel The Robot: A Gentle Introduction to the Art of Programming. John Wiley & Sons, 1981. ISBN 0-471-59725-2.
  • Joseph Bergin, Mark Stehlik, Jim Roberts, Richard E. Pattis. Karel++: A Gentle Introduction to the Art of Object-Oriented Programming. John Wiley & Sons, 1996. ISBN 0-471-13809-6.

External links

de:Niki – der Roboter es:Karel el Robot eu:Karel robota sk:Karel (programovací jazyk) tr:Karel (programlama dili)

Personal tools

Served in 0.138 secs.