Quickstart
Build or use `vela`, run your first program, and reach the core Stage-0 features quickly.
Vela is a Stage-0 from-scratch interpreter today, so this section is anchored in what the seed actually runs.
1. Build and run
From the interpreter repo:
cargo build --release
./target/release/vela run examples/hello.vela
./target/release/vela repl
The same commands are documented in ../README.md and mirror platform/apps/stretchdevdocs-web/.sources/vela/docs/README.md.
2. Hello world
# hello.vela
print("Hello, Vela!")
Hello, Vela!
3. One binding style
Bindings are immutable by default:
x = 1
x = 2
vela: line 2: cannot reassign immutable binding `x` (declare it with `mut`)
Use mut when a value must be reassigned.
mut count = 0
count = count + 1
4. Source layout pattern
The command-line takes a .vela file:
vela run examples/hello.vela
vela run examples/calculator.vela
vela run <file> and vela <file> are both shown as valid in the docs; both execute
the same file.
5. Built-in command-line args
ARGV is a global list:
if ARGV.len == 0:
print("no arguments given. try: vela run examples/args.vela Alice Bob")
else:
print("got", ARGV.len, "argument(s):")
for name in ARGV:
print(" hello,", name)
6. Imports in the seed
Stage-0 supports importing another file with use "path":
use "lib/greet.vela"
print(greet("Vela"))
The reference says it is loaded once and use paths are resolved by path string.
7. Next
- Language Tour for the first 20 minutes walkthrough.
- Syntax & Types to learn each language form and evaluation rule.
- Design Notes for what is still planned in the self-hosted compiler.