vib-lang
= Vib Lang: A Modern, Versatile Programming Language :author: Michal92299 📅 November 27, 2025 :revnumber: 0.1.0 :toc: left :sectnums: :icons: font :sectanchors: :source-highlighter: rouge
== Introduction
Vib Lang is a fictional yet innovative programming language designed primarily for hackers, Linux enthusiasts, and developers seeking a balance between simplicity and power. Drawing inspiration from Python, Ruby, and JavaScript, Vib offers an expressive syntax with unique features such as flexible memory management (manual or automatic), straightforward library imports, and embedded code blocks for seamless integration with other languages like Rust, C, or Java.
Vib Lang aims to be efficient, extensible, and enjoyable to use. It supports multiple compilation targets: native binaries via LLVM for high performance, translation to established languages (Rust, C, Java) for interoperability, and execution through a custom virtual machine (VM) that's simpler and more efficient than traditional JVMs. This makes Vib suitable for everything from quick scripts to performance-critical applications.
Key features include:
- Clean Syntax: Uses square brackets
[]for blocks, eliminating indentation issues while maintaining readability. - Memory Control: Choose
<automatic>for refcounting (safe and easy) or<manual>for zero-overhead allocation in high-performance scenarios. - Interoperability: Embed foreign code directly with
#=lang={ code }for hybrid development. - Comprehensive Toolchain: The
vibCLI handles compilation, translation, VM execution, and package management. - Package Ecosystem: Integrated with the
bytespackage manager for dependency resolution. - Performance-Oriented: LLVM backend ensures near-native speeds; VM is optimized for low-latency scripting.
This README provides a detailed overview, installation guide, usage instructions, syntax highlights, examples, benchmarks, contributing guidelines, and more. Vib is open-source under the GPL-3.0 license, encouraging community contributions.
== Installation
Vib Lang is optimized for Linux environments but can be adapted to other Unix-like systems. The installation process places the main CLI in /usr/bin/ and supporting binaries/libraries in /usr/lib/vib-lang/.
=== Fast Download ==== For HackerOS [source,bash]
curl -sSL -o install.hacker https://raw.githubusercontent.com/michal92299/vib-lang/main/install.hacker hackerc run install.hacker
==== For every linux distro [source,bash]
curl -sSL -o install.hacker https://raw.githubusercontent.com/michal92299/vib-lang/main/install.sh ./install.sh
=== Prerequisites
- Rust (version 1.80+): For the compiler and virtual machine.
- Crystal (version 1.10+): For the translator and main CLI.
- Zig (version 0.13+): For the parser.
- LLVM (version 18+): Required for native compilation.
- Build Tools:
cargo,crystal build,zig build, andmakeor similar. - Optional:
bytespackage manager (installed separately for dependency handling).
Install prerequisites on Ubuntu/Debian: [source,bash]
sudo apt update sudo apt install rustc crystal zig llvm
=== Building from Source
- Clone the repository:
[source,bash]
git clone https://github.com/xai/vib-lang.git cd vib-lang
- Build individual components (run from the root directory):
- Virtual Machine (Rust):
[source,bash]
cd virtual-machine cargo build --release
- Compiler (Rust):
[source,bash]
cd ../compiler cargo build --release
- Translator (Crystal):
[source,bash]
cd ../translator crystal build src/translator.cr --release -o translator
- Parser (Zig):
[source,bash]
cd ../parser zig build-exe main.zig -O ReleaseFast
- Vib CLI (Crystal):
[source,bash]
cd ../vib crystal build src/vib.cr --release -o vib
- Install system-wide:
[source,bash]
sudo mkdir -p /usr/lib/vib-lang/bin /usr/lib/vib-lang/lib sudo cp virtual-machine/target/release/virtual-machine /usr/lib/vib-lang/bin/ sudo cp compiler/target/release/compiler /usr/lib/vib-lang/bin/ sudo cp translator/translator /usr/lib/vib-lang/bin/ sudo cp parser/main /usr/lib/vib-lang/bin/parser sudo cp vib/vib /usr/bin/vib
Copy any shared libs (if added) to /usr/lib/vib-lang/lib/
Set environment variables if needed: + [source,bash]
export VIB_BIN_PATH=/usr/lib/vib-lang/bin
- Verify installation:
[source,bash]
vib --version
=== Package Manager (bytes)
Vib integrates with bytes, a simple package manager for dependencies. Install bytes from source or via your distro's package manager if available. Example bytes.yaml handles dependencies like standard libraries.
== Project Structure
A standard Vib project follows this layout:
my-project/ ├── bytes.yaml # Dependency manifest and project metadata (YAML) ├── cmd/ # Source directory │ └── main.vib # Entry point file ├── lib/ # Custom libraries (optional) │ └── mylib.vib # Example library ├── tests/ # Test files (optional) │ └── test_main.vib # Unit tests └── build/ # Build artifacts (generated) ├── build.hacker # Translation/build configuration └── release/ # Compiled binaries, .object, or .vib-vm files
bytes.yamlexample:
[source,yaml]
name: my-project version: 0.1.0 author: Your Name description: A sample Vib project dependencies: [] # No external deps for pure projects memory: automatic # Default memory mode
- Use
vib initto scaffold a new project automatically.
== Usage
The vib CLI is the unified interface for all operations. It dispatches to sub-binaries (compiler, translator, etc.) transparently. Run vib help for a full list.
=== Core Commands
vib init: Initializes a new project withbytes.yamlandcmd/main.vib.
[source,bash]
vib init
vib c: Compiles the project to a native binary. Checks dependencies and builds in/build/release/main.
[source,bash]
vib c
vib c <file.vib>: Compiles a single file.
[source,bash]
vib c hello.vib # Outputs 'hello' binary
vib t: Translates the project and generates/build/build.hacker.
[source,bash]
vib t
vib t <file.vib> <lang>: Translates a file torust,c, orjava, with TUI for further compilation.
[source,bash]
vib t main.vib rust # Outputs main.rs
vib vm build: Builds project to VM bytecode (.object).
[source,bash]
vib vm build
vib vm compile <file.object>: Packages.objectto.vib-vm.
[source,bash]
vib vm compile main.object # Outputs main.vib-vm
vib run <file.vib-vm>: Executes a VM file.
[source,bash]
vib run app.vib-vm
=== Package Management
vib install: Installs dependencies frombytes.yaml.
[source,bash]
vib install
vib remove: Removes dependencies.
[source,bash]
vib remove
=== Build & Maintenance
vib build: Builds based on/build/build.hacker(e.g., translates and compiles).
[source,bash]
vib build
vib clean: Removes the/build/directory.
[source,bash]
vib clean
=== Help & Info
vib help: Displays detailed help.vib version: Shows version.vib docs: Built-in documentation.vib tutorials: Interactive tutorials.
Options like -v (verbose) can be used with any command.
== Syntax Overview
Vib's syntax is intuitive and hacker-friendly.
=== Comments
Line comments start with ->.
Example: [source,vib]
-> This is a comment
=== Memory Management
Use <mode> at the top.
Example: [source,vib]
-> Refcounting -> Explicit alloc/free
=== Imports
Simple :lib: syntax.
Example: [source,vib]
:std: -> Standard library
=== Output/Input
write for output, read for input.
Example: [source,vib]
write "Hello!" let input = read()
=== Blocks & Control Flow
Blocks use []; if/while are bracket-based.
Example (if-else): [source,vib]
[ cond ] [ true_block ] [ false_block ]
Example (while): [source,vib]
[ cond ] [ body ]
=== Functions & Classes
JS-like syntax.
Example (function): [source,vib]
fn add(a, b) [ return a + b; ]
Example (class): [source,vib]
class Point [ fn init(x, y) [ self.x = x; self.y = y; ] ]
=== Embedded Code
Inline other languages.
Example: [source,vib]
#=rust={ println!("Rust inside Vib!"); }
=== Variables & Expressions
let for declarations.
Example: [source,vib]
let x = 42; x = x + 1;
== Examples
=== Hello World (hello.vib)
[source,vib]
Compile & run: [source,bash]
vib c hello.vib ./hello
=== Simple Project
See the provided main.vib and bytes.yaml in the repository for a dependency-free example.
== Performance Benchmarks
Vib is designed for efficiency. Based on 2025 benchmarks (simulated on x86-64):
- Natywny vs. Others: Comparable to Rust/Go for compute-heavy tasks (e.g., Fibonacci: ~13ms vs. Rust's 13ms).
- VM Mode: Faster than Python (10x in loops) but slower than native (~2x).
- Translation: To Rust – identical performance; to Java – JVM JIT benefits long-running apps.
For details, see our benchmark suite in /benchmarks/.
== Contributing
We welcome contributions! Fork the repo, create a branch, and submit a pull request.
- Issues: Report bugs or features on GitHub.
- Code Style: 2-space indentation,
->comments. - Testing: Add tests in
/tests/; runvib test(future feature).
== License
Vib Lang is licensed under the GPL-3.0 License. See the LICENSE file for full details. This ensures the project remains free and open, with contributions benefiting the community.
vib-lang
- 0
- 0
- 0
- 0
- 0
- 1 day ago
- November 27, 2025
GNU General Public License v3.0
Sat, 29 Nov 2025 03:29:19 GMT