Skip to main content

Chapter 1 - Getting Started

Installation

Linux/macOS

Build XVR from source:

git clone https://github.com/slowy07/xvr
cd xvr
make

The compiler is in out/xvr.

Windows

Prerequisites

  1. Install LLVM

  2. Install MSYS2 (recommended)

Build XVR

# Clone the repository
git clone https://github.com/slowy07/xvr
cd xvr

# Build using MinGW
mingw32-make

Or using PowerShell:

# Using PowerShell
# Install LLVM first via winget or download
winget install LLVM.LLVM

# Clone and build
git clone https://github.com/slowy07/xvr
cd xvr
mingw32-make

Troubleshooting Windows Build

ErrorSolution
clang: command not foundAdd LLVM bin folder to PATH
undefined reference to LLVM*Ensure LLVM libraries are in PATH
make: *** No rule to make targetUse mingw32-make on Windows

Verify Installation

out\xvr.exe --version

Hello World

Create a file hello.xvr:

std::print("Hello, World!");

Running

# Compile and run
./out/xvr hello.xvr

Output:

Hello, World!

Options

./out/xvr -h          # Show help
./out/xvr -v # Show version
./out/xvr hello.xvr -l # Dump LLVM IR
./out/xvr hello.xvr -o prog # Compile to executable
./out/xvr hello.xvr -c -o hello.o # Compile to object file