Getting Started with Arc
🎮 Want to try Arc without installing? Use the Online Playground!
Installation
Option A: Global Install (recommended)
bash
npm install -g arc-langOption B: From Source (for contributors)
bash
git clone https://github.com/kai-builds-ai/arc-lang.git
cd arc-lang/compiler
npm install
cd ..Requirements: Node.js 18+ and npm.
Editor Support
Install the Arc extension for VS Code for syntax highlighting, diagnostics, hover info, go-to-definition, and completions. Search "Arc Language" in the Extensions panel.
Your First Program
Create a file called hello.arc:
arc
let name = "World"
print("Hello, {name}!")Run it:
bash
# If installed globally
arc run hello.arc
# If running from source
npx tsx compiler/src/index.ts run hello.arcOutput:
Hello, World!Using the REPL
Start an interactive session:
bash
# If installed globally
arc repl
# If running from source
npx tsx compiler/src/index.ts replArc REPL v0.1 — Type expressions to evaluate
> 2 + 3
5
> let x = 10
> x * 2
20
> [1, 2, 3] |> map(x => x * 2)
[2, 4, 6]Language Basics
Variables
arc
let name = "Arc" # immutable (default)
let mut count = 0 # mutable (opt-in)
count = count + 1Functions
arc
# Expression body (one-liners)
fn add(a, b) => a + b
# Block body
fn greet(name) {
let msg = "Hello, {name}!"
print(msg)
msg
}Pipelines
Chain operations left-to-right instead of nesting:
arc
# Instead of: sum(map(filter(data, ...), ...))
data |> filter(x => x > 0) |> map(x => x * 2) |> sumPattern Matching
One construct for branching, destructuring, and type checking:
arc
match value {
0 => "zero",
n if n < 0 => "negative",
n => "positive: {n}"
}Collections
arc
let list = [1, 2, 3, 4, 5]
let evens = [x for x in list if x % 2 == 0]
let map = {name: "Arc", version: 1}Tool Calls
First-class API calls — no imports, no setup:
arc
let user = @GET "api/users/{id}"
@POST "api/messages" {text: "hello"}Next Steps
- Language Tour — Complete walkthrough of every feature
- Standard Library Reference — Full stdlib API
- Standard Library Tutorial — Hands-on guide
- Examples — Real-world programs with token comparisons
- FAQ — Common questions answered
- Cheatsheet — Quick reference