Pakistan's First High-Performance Compiled Language with Express-Like Syntax
π’ Language Development Status
Important
ScarScript v1.0.3 (Under Testing & Benchmarking)
ScarScript is under active development by Team Scarfaze. Following the release of v1.0.2 (which introduced initial LSP server support for VS Code), our engineering team is currently running rigorous benchmarking and testing for the upcoming v1.0.3 release.
Once testing and performance stabilization are finalized, v1.0.3 will be officially deployed. We deeply appreciate your bug reports, feedback, and contributions as we continue building Pakistan's first high-performance compiled language!
β Team Scarfaze
β‘ Try ScarScript Online (WebAssembly Playground)
Want to test ScarScript instantly without installing anything locally? You can now test the beta version directly inside your browser powered by WebAssembly (Wasm) and built-in Emmet system support:
π Launch ScarScript Interactive Playground
ScarScript is a statically-typed, compiled scripting language that transpiles to Go. It combines the readability of Express.js-style syntax with the performance and safety of Go.
β¨ Key Features
| Feature | Description |
|---|---|
| Express-like Syntax | func, val/mut/const, for ... in, if/else with braces |
| Static Type Checking | Full compile-time type inference with strict rules |
| Multiple Returns | Go-style func() (int, bool) with val a, b = f() |
| Anonymous Functions | Closures with capture: val h = func(x) { ... } |
dec Type |
64-bit float with int-literal widening (val x: dec = 4) |
| Built-in Modules | math, file, sys, time β zero dependencies |
| Transpiles to Go | Self-contained .gen.go β go build / go run |
| Zero Runtime | No interpreter, no VM β pure Go binary |
β‘ Performance & Benchmarks
ScarScript transpiles directly to Go and compiles to a native binary β delivering Go-level performance with a cleaner syntax.
Benchmark: 10,000,000 loop iterations (for i in 1..10_000_000 { })
| Language | Execution Time | Relative Speed | Notes |
|---|---|---|---|
| ScarScript | 0.165 s | 1.00Γ (baseline) | Native binary, zero runtime |
| Go (reference) | ~0.155 s | 1.06Γ faster | Direct Go implementation |
| Node.js (v20) | ~0.95 s | 5.8Γ slower | V8 JIT, warmup required |
| Python (3.11) | ~3.8 s | 23Γ slower | CPython interpreter |
Key Insight: ScarScript adds < 7% overhead vs hand-written Go, while being 6β23Γ faster than popular interpreted/JIT languages. No warmup, no JIT β just instant native speed.
# Reproduce the benchmark cat > bench.scar << 'EOF' mut sum = 0 for i in 1..10_000_000 { sum = sum + i } print("Sum: {sum}") EOF scar build bench.scar -o bench time ./bench
π Quick Start
Option 1 β Download Binary (no Go needed):
Grab your platform binary from Releases:
| Platform | File |
|---|---|
| πͺ Windows | scar-windows-amd64.exe |
| π§ Linux | scar-linux-amd64 |
| π macOS (Intel) | scar-darwin-amd64 |
| π macOS (Apple Silicon) | scar-darwin-arm64 |
Option 2 β Go Install:
go install github.com/ScarfazeCompany/scar-script/cmd/scar@latest
Write your first script (hello.scar):
func greet(name: str) {
print("Hello, {name}!")
}
greet("Zawiyar")
Run it:
scar run hello.scar # Hello, Zawiyar! # Build a binary scar build hello.scar -o hello ./hello
Or build all platforms yourself:
# Windows .\scripts\build.ps1 # Linux / macOS ./scripts/build.sh
π Syntax Overview
// Variables (immutable by default)
val name: str = "Zawiyar"
mut count: int = 0
const API_URL: str = "https://api.scar.com"
// Type inference
val inferred = 42 // int
val price = 99.99 // dec
val flag = true // bool
// Functions
func add(a: int, b: int) int {
return a + b
}
// Multiple returns (Go-style)
func divide(a: int, b: int) (int, bool) {
if b == 0 {
return 0, false
}
return a / b, true
}
val result, ok = divide(10, 2)
// Anonymous functions / closures
val multiply = func(x: int, y: int) int {
return x * y
}
// Control flow
if age >= 18 and active {
print("Access granted")
} else {
print("Denied")
}
// Universal for loop
for i in 1..10 { ... }
for item in items { ... }
for k, v in map { ... }
for condition { ... }
// String interpolation
print("User {name} is {age} years old")
// Smart defaults (JS-style 'or')
val port = sys.env("PORT") or "8080"
val status = data.status or "unknown"
// Modules
val root = math.sqrt(16) // 4.0
val rnd = math.rand(1, 100)
file.write("log.txt", "started")
val cfg = file.read("config.json")
time.sleep(1000)
val now = time.now()
π¦ Built-in Modules
| Module | Functions |
|---|---|
| math | sqrt(dec) dec, pow(dec, dec) dec, abs(int) int, round(dec) int, rand(int, int) int |
| file | write(str, str), append(str, str), read(str) str, exists(str) bool, delete(str) |
| sys | env(str) str |
| time | now() str, sleep(int) |
π CLI Reference
scar run <file.scar> # Compile & run (uses temp dir) scar build <file.scar> [-o out] # Build static binary scar version # Show version scar help # Show help
π How It Works
scar run hello.scar
β
βΌ
βββββββββββββββββββββ
β Lexer β Parser β (panic-based errors, precise positions)
βββββββββββ¬ββββββββββ
β
βΌ
βββββββββββββββββββββ
β Type Checker β (phase-1 func registry, full static analysis)
β β’ assigns types β
β β’ checks returns β
β β’ tracks unused β
βββββββββββ¬ββββββββββ
β
βΌ
βββββββββββββββββββββ
β Codegen β (emits self-contained .gen.go)
β β’ Go functions β
β β’ prelude helpersβ
β β’ gofmt validatedβ
βββββββββββ¬ββββββββββ
β
βΌ
go run / go build β native binary
π Documentation
- π Documentation Site β full docs with sidebar navigation
- Getting Started
- Language Syntax
- Type System
- Functions
- Standard Library
- CLI Reference
π€ Contributing
See CONTRIBUTING.md for guidelines.
π License
ScarScript is dual-licensed. You may use it under the terms of either:
Choose the license that best fits your use case.
π¨βπ» Author
Zawiyar Awan β Founder, Scarfaze
Pakistan's First High-Performance Compiled Language with Express-Like Syntax

