First Program
Once you've built the interpreter, the
scrii_repl interpreter runs scripts and an interactive REPL.
Running scripts
Run a file:
./build/interpreter/scrii_repl examples/01_hello_world/hello.scr
Start an interactive REPL:
./build/interpreter/scrii_repl
scrii interactive interpreter (Ctrl-D or :quit to exit)
> var x = 40 + 2
> print(x)
42
Your first program
Write your first script. Create hello.scr:
// comments are C-style
var name = "Scrii"
fn greet(who) {
return "Hello, " + who + "!"
}
print(greet(name))
print("type of name:", type(name))
Run it:
./build/interpreter/scrii_repl hello.scr
Hello, Scrii!
type of name: string
Running the examples
The repository ships runnable examples under examples/. Try a few:
./build/interpreter/scrii_repl examples/02_types/types.scr
./build/interpreter/scrii_repl examples/04_functions/functions.scr
./build/interpreter/scrii_repl examples/13_imports/import_example.scr
./build/interpreter/scrii_repl examples/14_async/async.scr
./build/interpreter/scrii_repl examples/25_http/http.scr
A complete hello-world style tour lives in examples/01_hello_world/.