This manual covers installation, CLI usage, and key workflows. For complete syntax, see HQL-SYNTAX.md.
See the build guide for build and install steps. If you do not install system-wide, use ./hlvm in the examples below.
Create hello.hql:
(print "Hello, World!")
Run it:
./hlvm run hello.hql
./hlvm repl
hlvm> (+ 1 2 3)
6
hlvm> (let name "HQL")
hlvm> (print "Hello," name)
Hello, HQL
// Variables
(let x 10) // Block-scoped mutable
(const PI 3.14159) // Immutable
(var count 0) // Function-scoped mutable
// Functions
(fn add [a b] (+ a b))
(fn greet [name = "World"]
(print "Hello," name))
// Type annotations (no space after colon!)
(fn add [a:number b:number] :number
(+ a b))
// Data structures
(let nums [1 2 3])
(let person {name: "Alice" age: 30})
// Control flow
(if (> x 10) "big" "small")
(cond
((< x 0) "negative")
((=== x 0) "zero")
(else "positive"))
See HQL-SYNTAX.md for complete syntax reference.
| Command | Description |
|---|---|
hlvm run <file> | Execute HQL file |
hlvm run '<expr>' | Evaluate expression |
hlvm repl | Start interactive REPL |
hlvm compile <file> | Compile to JavaScript |
hlvm init | Initialize new project |
hlvm upgrade | Show upgrade instructions |
hlvm compile app.hql # Dev build
hlvm compile app.hql --release # Production build
hlvm compile app.hql --target native # Native binary
hlvm compile app.hql -o myapp.js # Custom output
| Option | Description |
|---|---|
--help | Show help |
--version | Show version |
--verbose | Detailed logging |
--debug | Debug information |
See Standard Library Reference for complete documentation.
(first [1 2 3]) // 1
(rest [1 2 3]) // [2 3]
(take 2 [1 2 3 4]) // [1 2]
(drop 2 [1 2 3 4]) // [3 4]
(nth [1 2 3] 1) // 2
// map and filter return lazy sequences (print as lists like Clojure)
(map (fn [x] (* x 2)) [1 2 3]) // (2 4 6)
(filter (fn [x] (> x 2)) [1 2 3]) // (3)
// Use vec to get a concrete array
(vec (map (fn [x] (* x 2)) [1 2 3])) // [2 4 6]
// reduce consumes the sequence
(reduce + 0 [1 2 3 4]) // 10
(assoc {a: 1} "b" 2) // {a: 1, b: 2}
(dissoc {a: 1, b: 2} "a") // {b: 2}
(keys {a: 1, b: 2}) // ["a", "b"]
(vals {a: 1, b: 2}) // [1, 2]
(isNull x) // x === null
(isUndefined x) // x === undefined
(isNil x) // x == null
(isString x) // typeof x === "string"
(isNumber x) // typeof x === "number"
(isArray x) // Array.isArray(x)
| Document | Description |
|---|---|
| HQL-SYNTAX.md | Complete syntax reference (definitive) |
| TYPE-SYSTEM.md | TypeScript type system coverage |
| api/ | Complete API documentation |
| api/stdlib.md | Built-in functions |
| GUIDE.md | Learning guide from beginner to advanced |