Skip to content

Repository files navigation

Violette Programming Language

Violette — a statically typed compiled programming language combining the of Go/Kotlin/Swift with the speed of C/Rust.

Language Backend Version License


Key Features

  • Deterministic Memory Model: Fast reference counting (Perceus-style). (not ready yet)
  • Null-Safety & Zero-Values: No hidden null references.
  • UFCS Methods: Any function taking a struct or primitive as its first parameter behaves as a method (p.distance(), "Violette".len()).
  • Sprout Pipelines (~>): Functional dataflow operator for conveyor-style transformations.
  • Modular Standard Library: Embedded zero-cost prelude (prelude.vio)
  • Modern Terminal Diagnostics: Card-based error reporting like in Gleam

Code Examples

1. Methods & Pipeline Chaining

import math.{sqrt}

struct Point {
    x: float64,
    y: float64,
}

funс distance(p: Point, other: Point) [float64] {
    let dx = p.x - other.x
    let dy = p.y - other.y
    return sqrt((dx * dx) + (dy * dy))
}

funс main() {
    let p1 = Point { x: 0.0, y: 0.0 }
    let p2 = Point { x: 3.0, y: 4.0 }

    // Uniform Function Call Syntax:
    println(p1.distance(p2)) // 5.0

    // Multi-line fluent chaining:
    let result = (-64.0)
        .abs()
        .sqrt()
    
    println(result) // 8.0
}

2. Sprout Operator (~>)

funс fetch(url: string) [string] {
    return "payload"
}

funс parse(data: string) [string] {
    return "json"
}

funс validate(data: string) [bool] {
    return true
}

funс main() {
    // this string is the same as validate(parse(fetch("https://example.com")))
    let is_valid = "https://example.com" ~> fetch ~> parse ~> validate
    println(is_valid) // true
}

3. Strings & Prelude

funс main() {
    let text = "Violette"
    
    if !text.is_empty() {
        println("Length: " + text.len().to_string())
    }

    let clamped = clamp(150, 0, 100)
    println(clamped) // 100
}

Roadmap

  • Lexer & Tokenizer
  • Pratt Parser
  • Typechecker & Semantic Analysis with immutability by default
  • Flow Control Analysis
  • C-Transpiler Codegen with FFI
  • Embedded Standard Library
  • Selective & Dotted Imports (import math.{abs, sqrt}, import math.hypot)
  • Card-based Terminal Diagnostics with ANSI styling and helpful hints
  • Tagged Unions & Pattern Matching expressions (match + Win/Fail)
  • Error propagation postfix operator (|)
  • Perceus In-Place Buffer Reuse (FBIP) optimization
  • Native LLVM Backend (Target v1.0)

Building and Running

Prerequisites

  • Rust toolchain (Rust 1.80+)
  • A standard C compiler (clang or gcc)

Build from Source

git clone https://github.com/Krev3tka/Violette.git
cd Violette
cargo build --release

Run an Example

# Run any .vio file directly:
./target/release/violette run examples/demo_showcase.vio

Nix Environment (Reproducible)

nix develop
nix build

Running Tests

Integration and snapshot tests are managed via the built-in test suite:

# Run Rust unit tests:
cargo test

# Run full integration test suite:
cd tools/Viotestte && go run main.go

Support the Development

Violette is an independent open-source project. If you'd like to support the language design and compiler development:

  • ERC-20 / ETH: 0x7ecc5C0a8A24dfCB885966a98aEc60fC8D736422

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

New compilable programming language with an emphasis on type safety and pure syntax

Topics

Resources

Stars

24 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages