vision
Install

Concept guide

Your first program

Build the current compiler, write two lines of Vision, and follow them all the way to a native program.

Build the compiler

Follow the install page to grab the source from Kepr and have a working source tree on disk. Make sure Bison, Flex, and a C compiler are available, then from inside the source directory run make. The compiler will be at build/vision.

Write the file

Create first-program.vis in the checkout and give it this complete program:

first-program.viscompiler checked
to begin:
    say "hello, vision"
to begin:
    say "hello, vision"
This fixture is compiled to C, built as a native program, and run during the website build.

Read its shape

to begin: declares the zero-input verb the compiler emits as the C program entry point. The indented line belongs to that verb. say writes its value followed by a newline.

That is enough for a runnable file: a .vis source file, an entry verb, and an indented body. Larger programs add more top-level declarations around this same shape. The next guide walks through verbs and described things without turning this first program into a language reference.

Compile and run

The current compiler emits C; it does not turn an ordinary source file directly into a native executable. Run these steps from the Vision checkout:

  1. Emit C with ./build/vision first-program.vis -o first-program.c.
  2. Build the native program with cc -std=c11 first-program.c -lm -pthread -o first-program.
  3. Run it with ./first-program.

The program writes hello, vision followed by a newline. The documentation gate checks those exact output bytes, not only whether the example exits successfully.

Try it yourself

Change the greeting to your own words. Then add a second say line at the same indentation and predict the two output lines before you rebuild. Move that line back to the left edge and try again: it is now outside begin, so the compiler rejects it. Indentation is part of the program.

Once that feels ordinary, continue to How Vision thinks for the ideas behind the syntax.