Skip to content

The first program

Write this text into hello.rgr:

class Main {
sfn main:void () {
def name "world"
print ("hello " + name)
}
}

The program has one class. The static function main is the entry point. The operator def declares a variable, and the compiler finds the type of the variable from the value.

Terminal window
rgrc hello.rgr -l=es6 -d=./bin -o=hello.js
node bin/hello.js

The program writes hello world.

Terminal window
rgrc hello.rgr -l=go -d=./bin -o=hello.go
rgrc hello.rgr -l=python -d=./bin -o=hello.py
rgrc hello.rgr -l=rust -d=./bin -o=hello.rs

The operator reference shows the generated code of each operator for each target language.

Ranger 3.5.1 · commit f323fd4 · development build