Programming Language
Minimal systems language inspired by Pascal/Oberon
Source
Lexer
Parser
IR
Optimize
x86-64
Win64 PE
Under active development

What is Viper?

Viper is a minimal systems programming language for Windows x64, written entirely in Delphi. It draws from Pascal's structural clarity and Oberon's radical minimalism to produce a language where every feature earns its place.

The compiler includes its own native x64 code generation backend with SSA optimization, a PE/COFF linker, and a source-level DAP debugger. There is no LLVM. There is no GCC. There is no external toolchain. The entire pipeline — from source text to a running native executable — lives in one codebase with zero dependencies beyond the Delphi runtime library.

The result is a compiler small enough that one person can hold the entire architecture in their head, yet capable enough to produce efficient native binaries, dynamic libraries, static libraries, and JIT-compiled functions.


Features
Native x64 Backend
Generates real x86-64 machine code. SSA-based IR with constant folding, copy propagation, CSE, and dead code elimination.
📦
Zero Dependencies
Nothing beyond the Delphi RTL. No DLLs to ship, no toolchains to install. One codebase, full pipeline.
📖
Clean Syntax
Pascal/Oberon-inspired. Strong typing, explicit declarations, begin/end blocks. Code that reads without special training.
🔗
Built-in C Interop
The C header importer translates .h files into importable Viper module units. Use raylib, SDL, or the Windows API directly.
🐞
DAP Debugger
Source-level debugging with breakpoints, stepping, variable inspection, and call stack — for both executables and JIT code.
🧩
Embeddable Engine
The backend is a reusable Delphi class. Build your own language, scripting engine, or runtime code generator on the same engine.

Code Examples

Seven lines. A native Win64 executable. No runtime, no garbage collector, no VM.

Hello World
module exe test_exe_hello;

begin
  writeln("Hello from Viper!");
end.

Routines support value and reference parameters, overloading by signature, and recursion.

Routines & Overloading
routine add(const a: int32; const b: int32): int32;
begin
  return a + b;
end;

routine factorial(const n: int32): int32;
var
  result: int32;
  i: int32;
begin
  result := 1;
  for i := 1 to n do
    result := result * i;
  end;
  return result;
end;

Import C libraries directly. The built-in C importer translates headers into .vpu module units.

C Library Interop — Raylib
module exe test_exe_raylib;

@modulepath "../libs/raylib/imports";

import
  raylib;

const
  CScreenWidth  = 800;
  CScreenHeight = 450;

begin
  raylib.InitWindow(CScreenWidth, CScreenHeight, "Raylib Window");
  raylib.SetTargetFPS(60);

  while not raylib.WindowShouldClose() do
    raylib.BeginDrawing();
      raylib.ClearBackground(raylib.RAYWHITE);
      raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
    raylib.EndDrawing();
  end;
  raylib.CloseWindow();
end.

Three-Layer Architecture

Viper's compiler is structured as three independent layers. Each can be used standalone — you can build an entirely different language on the same engine.

Layer 1
Backend — TViperBackend
A standalone Delphi class that produces native Win64 binaries from a fluent API. Define types, emit statements, set a target, call Build. Knows nothing about any programming language.
Types IR SSA x64 PE/COFF
Layer 2
Middle — TViperMiddle
A language-agnostic compiler engine. Register tokens, grammar handlers, semantic rules, and code emitters through TLangConfig. The engine provides the lexer, Pratt parser, and unified AST automatically.
Lexer Parser Semantics Emit

The Frontend is the thinnest layer — three Delphi source files containing grammar, semantic, and emitter registrations. These three files are the entire Viper language definition. Everything else is provided by the Middle Layer and Backend.


Building from Source
1
Clone the repository
git clone https://github.com/tinyBigGAMES/ViperLang.git
2
Open in Delphi
Open src\ViperLang.groupproj in Delphi 12 Athens or later.
3
Build all projects
Build the project group. The compiled Viper.exe is output to bin\.
Host OS Windows 10/11 x64
Build tool Delphi 12 Athens or later
Dependencies None beyond the Delphi RTL
License Apache License 2.0

Documentation

Media
Viper Infographic

Community

Viper is built in the open. Whether you're fixing a bug, writing your first program, or just curious about language design, you're welcome.