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

APINotes
printstdout
str int float bool typeofconvert / type
len push pop range join …collections
upper lower split replace …strings
storage_get/set/delete/keysneeds storage
read_file write_fileproject-root only
Forbidden foreverexec spawn system shell eval ffi dlopen

Capabilities

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)
    }
  }
}