Lines starting with # or containing # are comments.
# This is a comment
x = 10 # Inline comment
Variables can store numbers, strings, booleans, and expressions.
x = 10
y = 2.5
name = "Raut"
flag = True
Use display(...) to print text or values.
display("Hello, RRL!")
display("Sum:", x + y)
display(robot)
You can use math expressions and safe built-ins (abs, min, max, round, int, float, str, bool, len, range, math.*).
x = math.sqrt(16)
y = abs(-10)
z = max(1, 5, 3)
Conditional blocks control execution flow.
if x > 5
display("x is big")
elif x == 5
display("x is exactly 5")
else
display("x is small")
endif
Repeats the body exactly N times.
repeat 3
display("Hello!")
endrepeat
Repeats while the condition is true. Limited to 1,000,000 iterations for safety.
while x > 0
display("Counting:", x)
x = x - 1
endwhile
Define reusable code blocks with parameters and return values.
def add(a, b)
return a + b
enddef
result = add(10, 20)
display("Result:", result)
A built-in object for simulating robot movement.
robot.move(5)
robot.rotate(90)
robot.stop()
display(robot)
Special commands for the interactive REPL environment.
:help → show help
:env → show current variables & functions
:quit → exit REPL
Complete example: move the robot in a square.
def square(side)
repeat 4
robot.move(side)
robot.rotate(90)
endrepeat
enddef
square(5)
display("Done! Robot:", robot)
You can convert rrl.py into an executable and run .rrl files directly.
pip install pyinstallerpyinstaller --onefile rrl.pyThis will generate an rrl.exe file inside the dist folder.
- Go to System Environment Variables → Path
- Add the dist folder path
-
In Command Prompt:
rrl.exe test.rrl
-
In VS Code or any code editor:
-
Create a
.rrlfile -
Run it with:
rrl.exe filename.rrl
-
RRL is released under the MIT License.