Language reference
Programs live in .vamp files. Compiled to bytecode, run on a sandboxed VM.
Entry styles
print(1 + 2)
fn main() {
print(1 + 2)
return 0
}Syntax
let x = 10
const NAME = "app"
if x > 0 { print("ok") } else { print("no") }
while x > 0 { x = x - 1 }
for i in range(0, 10) {
print(i)
}
fn add(a, b) {
return a + b
}Values: null, bools, ints, floats, strings, lists, maps.
Imports
import "lib/util"
fn main() {
print(util_message())
}Standard library
| API | Notes |
|---|---|
print | stdout |
str int float bool typeof | convert / type |
len push pop range join … | collections |
upper lower split replace … | strings |
storage_get/set/delete/keys | needs storage |
read_file write_file | project-root only |
Forbidden forever
exec spawn system shell eval ffi dlopenCapabilities
capabilities = ["ui", "storage", "clock", "fs.read", "fs.write"]
@capability("storage")
fn save(k, v) {
storage_set(k, v)
}UI components
component Home {
state count = 0
fn inc() { count = count + 1 }
view {
Column {
Text(count)
Button("Inc", onClick: inc)
}
}
}