Install the compiler

Download a release binary for your operating system from the ScarScript GitHub Releases. On Windows, rename the file to scar.exe if you want to run it as scar. On macOS or Linux, make the binary executable and put it on your PATH.

Check the installation:

scar version

You can also install the CLI from source with Go:

go install github.com/ScarfazeCompany/scar-script/cmd/scar@latest

Write a small program

Create a file named hello.scar:

func greet(name: str) {
    print("Hello, {name}!")
}

greet("world")

This example declares a function with a str parameter and uses ScarScript string interpolation to include the argument in the greeting.

Run and build it

Run the source file with:

scar run hello.scar

scar run uses Go to execute the generated program, so a Go toolchain must be installed and available on your PATH.

To create a native executable instead, use:

scar build hello.scar -o hello

On Windows, choose an output name ending in .exe, such as hello.exe. The built executable can run without the ScarScript compiler installed on the target machine.

Continue learning

The ScarScript syntax guide covers declarations, control flow, arrays, maps, and strings. The CLI reference documents the compiler commands and options.