Getting Started

Build the compiler, then compile and run a V# program.

Prerequisites

A JDK 25 and Gradle 9.x. That is the whole list — V# has no third-party dependencies to install.

Gradle must itself run on a JDK 25, because every module targets Java 25 and the compiler uses the Class-File API. If your Gradle launcher JVM is older, export JAVA_HOME=/path/to/jdk-25 before invoking Gradle, or set org.gradle.java.home=/path/to/jdk-25 rather than changing the toolchain.

Commands for obtaining a JDK 25 on each supported host are listed under platform support.

There are no binary releases yet. V# is at version 0.0.93-A and is built from source, as described below.

1. Build the tools

Obtain the sources and build the compiler:

git clone https://github.com/v-sharp-lang/v-sharp.git
cd v-sharp

installTools builds the compiler and prints the PATH line for your shell:

gradle installTools          # builds the compiler and prints the PATH line for your shell
export PATH="$PWD/vsharp-cli/build/install/vsharp/bin:$PATH"
vsharp --version             # V# 0.0.93-A (surface 4)

The install step writes both launchers: bin/vsharp, a Gradle #!/bin/sh start script that needs no bash, and bin\vsharp.bat for Windows.

2. Write a program

Create Hello.vs:

using System;

static int Fib(int n)
{
    return n < 2 ? n : Fib(n - 1) + Fib(n - 2);
}

Console.WriteLine($"fib(10) = {Fib(10)}");

3. Compile and run it

vsharp --out out Hello.vs
java -cp out:vsharp-runtime/build/libs/vsharp-runtime-0.0.93-A.jar Hello
# fib(10) = 55

Top-level statements become a public static void main(String[]) on a class named after the file. The output is a normal .class — nothing about running it is V#-specific.

On Windows the classpath separator is ; and paths are spelled with \. V# reads every path- and process-shaped decision from the running JVM rather than assuming one; see what differs per host.

Compiler options

The CLI has four output modes:

vsharp --out classes  src/*.vs          # directory output
vsharp --jar app.jar  src/*.vs          # one deterministic JAR
vsharp --classpath libs/dep.jar src/*.vs
vsharp --diagnostics compact src/*.vs   # one line per diagnostic, for CI

Two compilations of the same sources produce byte-identical artifacts. The complete list of options, exit codes, output modes and JDK visibility rules is in docs/CLI.md.

Building with Gradle

gradle/vsharp.gradle.kts is a dependency-free Gradle script plugin: apply(from = ...) and gradle build compiles your .vs sources.

Editor support

vsharp-lsp is a language server providing diagnostics, completion, signature help, hover, go-to-definition and symbols. It is packaged for VS Code and VSCodium as a .vsix extension with the server bundled. See docs/EDITORS.md.

If your JVM is too old

You get an instruction rather than a stack trace. A JVM older than 25 cannot load the compiler at all, so the launchers start a Java 11 preflight that names the version it found, the JVM it came from — usually a JAVA_HOME pointing somewhere unexpected — and the install command for your host, then exits 2:

$ vsharp --version
vsharp: V# requires Java 25 or later; this launcher is running Java 21
  the JVM in use is /opt/jdk21
  set JAVA_HOME to a Java 25 installation, or put its bin directory first on PATH
  install one with: apt install openjdk-25-jdk, dnf install java-25-openjdk, apk add openjdk25, or unpack any JDK 25 build

Next steps