Skip to content

v0.1.5-pre-beta

Choose a tag to compare

@LunaStev LunaStev released this 27 Nov 14:12
· 72 commits to master since this release
3760907

This release introduces the foundation of Object-Oriented Programming in Wave with the addition of Structs and Proto methods. Additionally, the build system has been completely overhauled to rely on system-installed LLVM libraries, significantly improving build stability and cross-platform compatibility.

Key Features

1. Structs & Field Access

You can now define custom data structures using the struct keyword and access their fields using dot notation.

  • Struct Definition: Define data containers with typed fields.
  • Field Access: Read values using object.field.
  • Pass-by-Value: Structs can be passed as arguments to functions.
struct Box {
    size: i32;
}

fun main() {
    var b: Box = Box { size: 42 };
    println("Size: {}", b.size);
}

2. Methods via proto

The proto keyword is now used to attach methods to existing structs.

  • Method Definition: Define methods associated with a specific struct.
  • self Parameter: Access the instance data within methods.
  • Method Call Syntax: Call methods using object.method().
proto Box {
    fun double_size(self: Box) -> i32 {
        return self.size * 2;
    }
}

3. Build System Overhaul

We have moved away from downloading custom LLVM binaries. The compiler now links against your system's LLVM installation.

  • System LLVM Detection: Automatically detects LLVM 14 on Linux, macOS (Homebrew), and Windows.
  • x.py Script: A new Python script (x.py) replaces Makefiles for easier building, testing, and packaging.
  • Cross-Compilation: Improved configuration for compiling Linux/Windows targets from a single environment.

4. CI/CD Improvements

  • Added macOS build workflows to GitHub Actions to ensure compatibility across major operating systems.

Fixes & Internal Changes

  • Parser Update: Improved lookahead logic to correctly distinguish between field access (obj.field) and method calls (obj.method()).
  • LLVM IR Generation: Refactored expression generation to handle struct literals and memory addresses more reliably.
  • Config: Fixed target-specific linker errors in .cargo/config.toml.