V / vulcan documentation

Language

First program

Vulcan combines a Rust-like execution and error model with a familiar typed expression syntax. Source files use the .v extension and compile to Vega bytecode.

Write a function

fn greeting(name: str): str {
  return `Hello, {name}!`
}

let message = greeting("Vulcan")
log `{message}`

Use fn for functions, let for local bindings, and name: Type for annotations. String interpolation uses braces inside a template string. Values are garbage-collected; there is no borrow checker.

Run and build

node n1/vulcan/lang/bin/vulc.ts run hello.v
node n1/vulcan/lang/bin/vulc.ts build hello.v

Build writes a .vega image. That image is the executable artifact; it is not JavaScript source. Which host capabilities are available depends on the runtime embedding the image.

Control flow

fn label(count: num): str {
  if count == 1 { return "one item" }
  return `{count} items`
}

log `{label(3)}`

Conditions are booleans. Vulcan does not use JavaScript truthiness. If, while and for are ordinary language constructs; braces delimit their bodies.

Calls and concurrency

Calls are automatically awaited. You do not write await or manage a visible Promise. Parallel work is explicit through constructs such as all, settle, race and spawn. An ordinary sequence of calls remains a sequence.

Imports

Imports connect source modules and standard libraries. A Venus application uses the versioned ui:venus@v0 kit import. Host modules describe capabilities provided by the embedding; a module name alone does not make that capability available on every target.