Skip to content
vynlangPublic

About

vyn programming language - Pragmatic Fork of the C++ Ecosystem

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Repository files navigation

🌿 Vyn Programming Language

A C++ successor with Rust-style memory safety — familiar syntax, native ABI compatibility, and zero-cost performance.


What is Vyn?

Vyn is a modern systems programming language built on the syntax, features, ABI and libraries of C++. It is a successor to C++ in the spirit of Carbon: it keeps the language developers already know instead of asking them to start over. Around 80–90% of Vyn syntax is taken directly from C++.

If C3 is a modern C, Vyn is a modern C++.

Why Vyn?

  • Memory safety on a C++ foundation. Vyn applies Rust-style ownership, borrowing and lifetime checking to C++ semantics — no garbage collector and no runtime overhead.
  • Zero-FFI C++ interoperability. Unlike Rust or Zig, Vyn shares the native C++ ABI (Itanium C++ ABI on Unix-like systems, MSVC ABI on Windows), so Vyn and C++ code call each other directly, without bindings or glue layers.
  • A familiar language. Declarations, expressions, operators and much of the standard vocabulary come straight from C++, so existing C++ developers are productive on day one.

History

Vyn began as a safe subset of C++. Strict C++ backwards compatibility soon became the limiting factor: ISO/IEEE standardization constraints blocked syntax modernizations and deeper compile-time safety guarantees. Vyn therefore grew into an independent language, keeping C++'s ergonomics, ABI and library model while defining its own specification.

The compiler became fully self-hosted on 22 November 2026: the C++ implementation was retired and vyn now builds itself (see Self-Hosted Compiler).

On 29 November 2026 the language was renamed Vyn and the project moved to vynlang/vyn. The rename also unified the toolchain: one vyn binary is both the package manager and the compiler (the package/build commands are subcommands of vyn, not a second executable), and the file extensions became .vyn for sources and .vym for module interfaces. Pre-rename .ivy sources and .ivm interfaces are still accepted while old trees are in circulation.


Core Language Features

  • Native Lifetime Annotations: Express reference validity cleanly without awkward attribute wrappers.
lifetime<$a, $b>
const int32& $a foo(
    const int32& $a x,
    const int32& $b y
) {
    return x; // ✅ OK: lifetime $a satisfies return lifetime $a
    // return y; // ❌ Error: lifetime $b cannot satisfy return lifetime $a
}
  • Zero-Cost Abstractions: Pure systems performance compiled directly to native code via LLVM.
  • Deterministic RAII & Explicit Moves: Resources destruct automatically upon exiting scope; moved-out variables are tracked and verified at compile-time.

Modern Compiler Pipeline

The vyn compiler architecture draws strong architectural inspiration from modern compilers (such as rustc):

Source (.vyn) ──► Lexer ──► Preprocessor ──► Parser ──► AST ──► HIR ──► MIR ──► LLVM IR ──► Native Binary
  • HIR (High-level IR): Performs rigorous type inference, template instantiation, and semantic validation.
  • MIR (Mid-level IR): Control Flow Graph (CFG) representation where borrow checking, lifetime verification, and safety validations occur.
  • LLVM IR: Emits optimized intermediate representation to leverage world-class LLVM optimization and code-generation pipelines.

VynInterpret

Unlike the restricted constexpr mechanisms in standard C++, Vyn features VynInterpret—a built-in, MIR-level tree-walking interpreter embedded directly within vyn.

  • Executes MIR in memory with zero backend compilation overhead (vyn --run <file.vyn>).
  • Enables advanced compile-time evaluation: pure code paths and side-effect-free calculations can run during compilation to embed direct values into output binaries.
  • Guarantees full memory safety validation before execution.

Self-Hosted Compiler (22 November 2026)

On 22 November 2026 Vyn reached full self-hosting: the vyn compiler is written in Vyn and builds itself. The C++ implementation that hosted the language until then has been retired from the repository; it remains in git history at tag 0.5-baseline together with its parity harnesses.

  • Bootstrap chain: checked-in seed (selfhost/bootstrap/vyn-stage0.exe) → stage 1 → stage 2, with byte-identical objects, module interfaces and executables (selfhost/build.ps1).
  • Gates: selfhost/build.ps1 -SelfLink -Golden (F2 + self-link + 1114-fixture golden parity) and selfhost/check_repro.ps1 (reproducible build).
  • CI: .github/workflows/selfhost-dogfood.yml runs the whole chain with no C++ compiler and no CMake.
  • Bug-compat (H10): every oracle bug listed in selfhost/ORACLE_BUGS.md is either reproduced on purpose (class A, with a regression fixture and a frozen golden record) or accepted with a documented reason; §9 there is the closing audit.

Requirements: Windows x64, PowerShell, and LLVM 21.1.6 (clang++ on PATH, or LLVM_ROOT pointing at the toolchain). The runtime object is built from std/rt.vyn by the build script.

# Build and verify the compiler with itself (no oracle, no CMake).
pwsh -NoProfile -File selfhost/build.ps1 -SelfLink -Golden

Status & Documentation

Vyn is actively establishing its independent language specifications and foundational documentation following its departure from strict C++ conformance.

  • Compiler Status: self-hosted as of 22 November 2026 (selfhost/).
  • Official Documentation: Explore language fundamentals, syntax, and memory safety rules in docs/.
  • Legacy Archive: Historical documentation and previous C++-subset specifications are archived at TheIvyProject/ivy (archive-2026-4-9).

License

Vyn is distributed under the Apache License 2.0.

About

vyn programming language - Pragmatic Fork of the C++ Ecosystem

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages