Scripting Language

The **Scripting Language** is a programming language that supports scripts and the main language used in RoboMind, to program the Robot mainly. Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. RoboMind requires the Robot to use scripts for actions.

## Characteristics

Typically scripting languages are intended to be very fast to learn and write in, either as short source code files or interactively in a read–eval–print loop (REPL, language shell). This generally implies relatively simple syntax and semantics; typically a "script" (code written in the scripting language) is executed from start to finish, as a "script", with no explicit entry point.

For example, it is uncommon to characterise Java as a scripting language because of its lengthy syntax and rules about which classes exist in which files, and it is not directly possible to execute Java interactively, because source files can only contain definitions that must be invoked externally by a host application or application launcher.

```
public class HelloWorld {
  public void printHelloWorld() {
    System.out.println("Hello World");
  }
}

```

This piece of code intended to print "Hello World" does nothing as *main()* is *not declared* in **HelloWorld** class.

In contrast, Python allows definition of some functions in a single file, or to avoid functions altogether and use imperative programming style, or even use it interactively.

`print ("Hello World")`

This one line of python code prints "Hello World"; no *declarative* statement like *main()* is required here.

A scripting language is usually interpreted from source code or bytecode. By contrast, the software environment the scripts are written for is typically written in a compiled language and distributed in machine code form.

Scripting languages may be designed for use by end users of a program—end-user development—or may be only for internal use by developers, so they can write portions of the program in the scripting language. Scripting languages typically use abstraction, a form of information hiding, to spare users the details of internal variable types, data storage, and memory management.

Scripts are often created or modified by the person executing them, but they are also often distributed, such as when large portions of games are written in a scripting language.

## RoboMind

RoboMind has its own scripting language and most likely special, the scripts are also called "instructions" and "commands", and additionally "programs". Scripts are often created or modified by the person executing them, those are some examples of the scripting language used:

Example script to draw square:

```
 paintWhite
 repeat(4) {
     forward(2)
     right
 }

```

Recursive line follower example:

```
 follow

 procedure follow{
     if(frontIsWhite){
               forward(1)
     }
     else if(rightIsWhite){
               right
     }
     else if(leftIsWhite){
          left
     }
     else{
          end
     }
     follow
 }

```

RoboMind offers a basic scripting language that consists of a concise set of rules. Apart from commands to make the robot perform basic movement instructions, the control flow can be modified by conditional branching (if-then-else), loops (while) and calls to custom procedures. The programming environment offers an integrated text editor to write these scripts, with syntax highlighting, autocompletion and line numbering.

## Modification

Modifications to the environment, such as painting grid cells, are used to store a runtime state. This shows the robot in its environment is directly related to 2D Turing machines. Since version 5.0, the language does allow the declaration of variables and functions (procedures that return values).

## Other Languages

The scripting language itself is currently available in 22 languages: Arabic, Catalan, Chinese, Czech, Dutch, English, French, German, Greek, Hungarian, Indonesian, Korean, Polish, Brazilian Portuguese, Russian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish and Ukrainian. All instructions and keywords can be translated. This makes it easier to learn for non-English speakers than most other programming languages that are constrained to English syntax and Latin alphabets.

## Trivia

* Codes can be discovered in this scripting language.
* The scripts in the Remote Control's script panel can be copied and placed on the general script panel.