ScarScript source files use the .scar extension. When you run or build a program, the ScarScript compiler checks the source and generates Go code; the Go toolchain then handles execution or native compilation.

The build flow

The process has three practical stages:

  1. Write a program in ScarScript, using its static types and language syntax.
  2. Let the scar CLI check the source and generate Go code.
  3. Use the Go toolchain to run that generated code or produce a native executable.

For example:

scar run hello.scar
scar build hello.scar -o hello

The Go toolchain must be available on the build machine for these commands. A compiled executable does not require the ScarScript compiler on the machine where it runs.

Inspect the generated program

ScarScript includes a browser Playground where you can try code and inspect generated Go source in the GO SOURCE tab. This is useful when learning how a language construct maps to the output, or when reporting an issue with a small reproducible example.

Why use this workflow?

The workflow keeps the source language focused on readable, statically typed programs while relying on Go tooling for execution and native binary generation. It also gives developers a concrete artifact to inspect: the generated Go source between the .scar program and the final executable.

For installation and a complete example, follow the getting-started guide. The CLI reference covers command usage, and the built-in modules reference documents the math, file, sys, and time modules.