Vais 프로그래밍 언어

Vais 1.0.0 (Vibe AI Language for Systems)

AI-optimized systems programming language with token-efficient syntax.

CI codecov

Vais is designed to minimize token usage while maximizing code expressiveness, making it ideal for AI-assisted development and LLM code generation.

Key Features

  • Single-letter keywords - F (function), S (struct), E (enum/else), I (if), L (loop), M (match)
  • Self-recursion operator @ - Call the current function recursively
  • Expression-oriented - Everything is an expression
  • LLVM backend - Native performance
  • Type inference - Minimal type annotations

Quick Example

# Fibonacci with self-recursion
F fib(n:i64)->i64 = n<2 ? n : @(n-1) + @(n-2)

# Struct definition
S Point { x:f64, y:f64 }

# Sum with loop
F sum(arr:[i64])->i64 {
    s := 0
    L x:arr { s += x }
    s
}

Syntax Overview

KeywordMeaningExample
FFunctionF add(a:i64,b:i64)->i64=a+b
SStructS Point{x:f64,y:f64}
EEnum/ElseE Option<T>{Some(T),None}
IIfI x>0{1}E{-1}
LLoopL i:0..10{print(i)}
MMatchM opt{Some(v)=>v,None=>0}
@Self-call@(n-1) (recursive call)
:=Infer & assignx := 42

Project Structure

crates/
├── vais-ast/      # Abstract Syntax Tree
├── vais-lexer/    # Tokenizer (logos-based)
├── vais-parser/   # Recursive descent parser
├── vais-types/    # Type checker
├── vais-codegen/  # LLVM IR generator
├── vais-lsp/      # Language Server Protocol
└── vaisc/         # CLI compiler & REPL

std/               # Standard library (47 modules)
vscode-vais/       # VSCode extension
docs/              # Documentation
examples/          # Example programs (105+ files)

Building

cargo build --release
cargo test

Test Coverage

This project uses cargo-tarpaulin to measure test coverage. Coverage reports are generated automatically in the CI pipeline.

Local Coverage Measurement

To generate coverage reports locally:

# Install cargo-tarpaulin (one-time setup)
cargo install cargo-tarpaulin

# Generate coverage reports (HTML and Lcov)
cargo tarpaulin --config tarpaulin.toml

# Or use the convenience alias
cargo coverage

# Generate HTML report only
cargo coverage-html

# Generate Lcov format for CI integration
cargo coverage-lcov

Coverage reports are saved to target/coverage/:

  • index.html - Interactive HTML coverage report
  • lcov.info - Lcov format for codecov integration

CI Integration

Coverage is measured automatically on every push and pull request to main and develop branches. Reports are:

  • Uploaded as GitHub Actions artifacts
  • Sent to Codecov for tracking trends
  • Available for 30 days in the CI artifacts

Usage

# Compile a Vais file
./target/release/vaisc build hello.vais -o hello

# Run directly
./target/release/vaisc run hello.vais

# Start REPL
./target/release/vaisc repl

# Format code
./target/release/vaisc fmt src/

# Check for errors
./target/release/vaisc check hello.vais

Status

  • Lexer (logos-based tokenizer)
  • Parser (recursive descent)
  • Type checker (generics, traits, type inference)
  • Code generator (LLVM IR)
  • Standard library (24 modules: Vec, HashMap, String, File, Net, etc.)
  • LSP support (diagnostics, completion, hover, go-to-definition, references, rename)
  • REPL (interactive environment)
  • VSCode extension (syntax highlighting, LSP integration)
  • Optimizer (constant folding, DCE, CSE, loop unrolling, LICM)
  • Formatter (vaisc fmt)
  • Debugger (DWARF metadata, lldb/gdb support)

Performance

Vais is designed for both compilation speed and runtime performance.

Compilation Speed

PhaseTime (avg)Throughput
Lexer~0.5ms/1K LOC~2M tokens/sec
Parser~1.2ms/1K LOC~800K AST nodes/sec
Type Checker~2.5ms/1K LOC~400K types/sec
Code Generator~3.0ms/1K LOC~300K IR lines/sec
Full Pipeline~7.5ms/1K LOC~130 files/sec

Runtime Performance

Fibonacci(35) benchmark:

LanguageTimeRelative
Vais (optimized)48ms1.0x
Rust (release)45ms0.94x
C (gcc -O3)44ms0.92x
Python3200ms67x

Running Benchmarks

# Compile-time benchmarks
cargo bench -p vais-benches --bench compile_bench

# Runtime comparison benchmarks
cargo bench -p vais-benches --bench runtime_bench

Documentation

Official Documentation Site

The comprehensive documentation is available as an interactive mdBook site:

# Build and view the documentation
cd docs-site
./serve.sh

Visit the online documentation or browse the individual files:

Memory Safety Testing

Vais ensures memory safety through Rust's ownership system and comprehensive testing:

# Run memory safety tests (without AddressSanitizer)
cargo test -p vaisc --test memory_safety_tests

# Run with AddressSanitizer (requires Rust nightly)
./scripts/asan-test.sh

# Run all sanitizers (ASan, UBSan, etc.)
./scripts/run-sanitizers.sh all

See MEMORY_SAFETY.md for detailed information on memory safety guarantees and testing.

Installation

Homebrew (macOS/Linux) - No Rust required

brew tap vaislang/tap
brew install vais

Pre-built Binaries

Download from Releases (Linux, macOS Intel/ARM, Windows):

# macOS ARM
curl -LO https://github.com/vaislang/vais/releases/download/v1.0.0/vais-v1.0.0-aarch64-apple-darwin.tar.gz
tar -xzf vais-v1.0.0-aarch64-apple-darwin.tar.gz
./vais/vaisc --version

From Source (requires Rust)

git clone https://github.com/vaislang/vais.git
cd vais && cargo build --release

Docker

docker run ghcr.io/vaislang/vais:latest --help

Community

Legacy

The prototype implementation is available on the proto branch.

License

MIT License