diff --git a/.github/CODE_EXAMPLE.md b/.github/CODE_EXAMPLE.md deleted file mode 100644 index e83165d1..00000000 --- a/.github/CODE_EXAMPLE.md +++ /dev/null @@ -1,194 +0,0 @@ -# Wave Programming Language - Code Examples and Explanation - -This document provides a series of code examples written in the Wave programming language. Each example demonstrates a specific feature or concept in the language, accompanied by a detailed explanation. - -## Input/Output -``` -fun main() { - print("Hello World?\n"); - println("Hello World!"); -} -``` -### Explanation: -* `fun main()`: This defines the main function, which serves as the entry point for the program. -In Wave, the `main` function is where the execution of the program begins, just like in C or Rust. - -* `print("Hello World?\n");`: The `print` function outputs the string `"Hello World?"` without appending a newline character at the end. -The `\n` ensures the output is followed by a newline. - -* `println("Hello World!");`: The `println` function is used to print the string `"Hello World!"` to the console, followed by a newline character. - -* Output: -``` -Hello World? -Hello World! -``` - -This example demonstrates how to use `print` for output without a newline and `println` for output with a newline. - -## Variables and Conditionals -``` -fun main() { - var x: i32 = 5; - var y: i32 = 10; - - if (x < y) { - println("x is less than y"); - } else { - println("x is greater than or equal to y"); - } -} -``` -### Explanation: -* `var x: i32 = 5;` and `var y: i32 = 10;`: These lines declare two variables, `x` and `y`, of type `i32` (32-bit integer), -and assign them initial values of 5 and 10, respectively. - -* `if (x < y) { ... } else { ... }`: This is and `if-else` conditional statement. -It checks if the value of `x` is less than `y`. If the condition is true, it prints `x is less than y`. -Otherwise, it prints `x is greater than or equal to y`. - -* Output: -``` -x is less than y -``` - -This example demonstrates how to declare variables, compare them, and use conditional logic. - -## Loops -### `while` Loop -``` -fun main() { - var i: i32 = 0; - - while (i < 5) { - println(i); - i = i + 1; - } -} -``` - -#### Explanation: -* `var i: i32 = 0;`: This line initializes a variable `i` with the value 0. - -* `while (i < 5) { ... }`: The `while` loop continues executing the code block as long as the condition `i < 5` holds true. -Inside the loop, the current value of `i` is printed, and `i` is incremented by 1. - -* Output: -``` -0 -1 -2 -3 -4 -``` - -### `for` Loop -``` -fun main() { - for (i in 0..4) { - println(i); - } -} -``` - -#### Explanation: -* `for (i in 0..4) { ... }`: The `for` loop iterates over the range `0..4`, effectively printing the values of `i` from 0 to 4. - -* Output: -``` -0 -1 -2 -3 -4 -``` - -This example demonstrates how the same task can be accomplished using a `for` loop, iterating through a specified range instead of manually managing the loop condition. - -## Functions -``` -fun greet(name: str) { - println("Hello, {} !", name); -} - -fun main() { - greet("Wave"); -} -``` - -### Explanation: -* `fun greet(name: str)`: This defines a function called `greet` that takes a single parameter `name` of type `str` (String). - -* `"println("Hello, {} !"), name"`: inside the function, we use a formatted string to print a greeting message that includes the value of `name`. - -* `greet("Wave")`: In the `main` function, we call the `greet` function with the argument `"Wave"`, which outputs the greeting message. - -* Output: -``` -Hello, Wave ! -``` - -This example demonstrate how to define and call a function with parameters in Wave, along with string formatting. - -## Error Handling -``` -fun divide(a: i32, b: i32) -> i32 { - if (b == 0) { - println("Error: Divison by zero"); - return -1; - } - return a / b; -} - -fun main() { - var result: i32 = divide(10, 2); - - if result != -1 { - println("Result: {}", result); - } -} -``` - -### Explanation - -* `fun divide(a: i32, b: i32) -> i32`: This defines a function called `divide` that takes two integers as parameters and returns an integer result. -* `if (b == 0) { ... }`: Inside the function, we check if `b` is zero. If it is, we print an error message and return `-1` to indicate an error. Otherwise, the function performs the division and returns the result. -* `var result: i32 = divide(10, 2)`: In the `main` function, we call `divide` with the arguments `10` and `2`, storing the result in the variable `result`. -* `if result != -1 { ... }`: We then check if the result is not equal to `-1` (indicating an error) and, if valid, print the result. - -* Output: -``` -Result: 5 -``` - -This example demonstrates how to handle errors, such as division by zero, and return an error value. - -## Arrays -``` -fun main() { - var arr = [1, 2, 3, 4, 5]; - - for (num in arr) { - println(num); - } -} -``` - -### Explanation: - -* `var arr = [1, 2, 3, 4, 5];`: This creates an array named `arr` containing the integers from 1 to 5. - -* `for (num in arr) { ... }`: The `for` loop iterates over each element in the array `arr`. In each iteration, the current element is stored in the variable `num`. - -* `println(num);`: Inside the loop, the current value of `num` is printed. - -* Output: -``` -1 -2 -3 -4 -5 -``` - -This example demonstrates how to declare an array and iterate through its elements using a `for` loop. \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1f3c9fb8..baa9b913 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ +open_collective: wave-lang github: [wavefnd, LunaStev] -open_collective: wave-lang \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6f2b1840..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Bug report -about: Create rvalue report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -### Bug Title: -(Brief description of the bug) - -### Environment: -- Operating System: (e.g., Windows 10, macOS, Ubuntu 20.04, etc.) -- Wave Version: (e.g., 1.0.0) -- Execution Environment: (e.g., Local, Server, etc.) - -### Steps to Reproduce: -1. (Step 1 to reproduce the bug) -2. (Step 2 to reproduce the bug) -3. ... - -### Expected Result: -(What should have happened if the bug didn’t occur) - -### Actual Result: -(What actually happened when the bug occurred) - -### Screenshot/Logs: -(Attach relevant screenshots or log files related to the bug) - -### Additional Information: -(Any additional information or special circumstances related to the bug) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..3fc331a0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,57 @@ +name: Bug report +description: Report a reproducible compiler, language, code generation, or toolchain defect. +title: "[Bug]: " +labels: + - bug +body: + - type: checkboxes + attributes: + label: Before submitting + options: + - label: I searched existing issues for the same problem. + required: true + - label: I can reproduce this with a supported Wave compiler build. + required: true + - type: input + attributes: + label: Wave version + description: Paste the complete output of `wavec --version`. + placeholder: wavec ... + validations: + required: true + - type: input + attributes: + label: Host environment + description: Operating system, architecture, and relevant toolchain versions. + placeholder: Fedora Linux, x86_64, LLVM ... + validations: + required: true + - type: input + attributes: + label: Target triple + description: The selected target, or `host default` if no target was passed. + placeholder: riscv64-unknown-linux-gnu + validations: + required: true + - type: textarea + attributes: + label: Reproduction + description: Include the smallest Wave source and the exact command needed to reproduce the problem. + render: shell + validations: + required: true + - type: textarea + attributes: + label: Expected behavior + validations: + required: true + - type: textarea + attributes: + label: Actual behavior and diagnostics + description: Include complete stdout, stderr, exit status, and backtrace when available. + validations: + required: true + - type: textarea + attributes: + label: Additional context + description: Add related files, regressions, linker/sysroot details, or anything else that may help. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..825cec39 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Design discussions and questions + url: https://github.com/wavefnd/Wave/discussions + about: Discuss language design, usage questions, and ideas before opening an implementation issue. + - name: Wave community + url: https://wave-lang.dev/community + about: Get help and talk with other Wave users and contributors. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index de31c2e1..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -### Feature Title: -(Brief description of the feature) - -### Background: -(Explain the reason or background for requesting this feature) - -### Expected Behavior: -(Describe in detail how this feature should behave) - -### User Scenarios: -1. (User scenario 1) -2. (User scenario 2) -3. ... - -### Additional Information: -(Any additional information or considerations related to the feature request) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..bf8855d3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,46 @@ +name: Feature request +description: Propose a focused language, compiler, target, standard library, or tooling improvement. +title: "[Proposal]: " +labels: + - enhancement +body: + - type: checkboxes + attributes: + label: Before submitting + options: + - label: I searched existing issues and discussions for this proposal. + required: true + - type: dropdown + attributes: + label: Area + options: + - Language and semantics + - Parser and frontend + - LLVM code generation + - Target and ABI support + - CLI and diagnostics + - Standard library + - Testing and CI + - Documentation + - Other + validations: + required: true + - type: textarea + attributes: + label: Problem + description: Describe the concrete limitation or use case this proposal addresses. + validations: + required: true + - type: textarea + attributes: + label: Proposed contract + description: Explain the expected syntax, semantics, CLI behavior, or target contract with examples where useful. + validations: + required: true + - type: textarea + attributes: + label: Alternatives and compatibility + description: Describe alternatives considered and any compatibility, migration, ABI, or platform impact. + - type: textarea + attributes: + label: Additional context diff --git a/.github/ISSUE_TEMPLATE/performance-issue-report.md b/.github/ISSUE_TEMPLATE/performance-issue-report.md deleted file mode 100644 index 5372b7e5..00000000 --- a/.github/ISSUE_TEMPLATE/performance-issue-report.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Performance Issue Report -about: Performance Issue -title: '' -labels: question -assignees: '' - ---- - -### Performance Issue Title: -(Brief description of the performance issue) - -### Environment: -- Operating System: (e.g., Windows 10, macOS, etc.) -- Wave Version: (e.g., 1.0.0) -- Hardware: (e.g., CPU, RAM, etc.) - -### Performance Problem Description: -(Describe the performance degradation and its impact) - -### Steps to Reproduce: -1. (Step 1 to reproduce the performance issue) -2. (Step 2 to reproduce the performance issue) -3. ... - -### Expected Performance: -(What performance should have been like if it was working normally) - -### Actual Performance: -(Describe the actual performance observed with degradation) - -### Additional Information: -(Any additional information or context related to solving the performance issue) diff --git a/.github/ISSUE_TEMPLATE/performance_report.yml b/.github/ISSUE_TEMPLATE/performance_report.yml new file mode 100644 index 00000000..e7e549a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/performance_report.yml @@ -0,0 +1,53 @@ +name: Performance report +description: Report a reproducible compiler-time, memory, code-size, or generated-code regression. +title: "[Performance]: " +labels: + - performance +body: + - type: input + attributes: + label: Wave version + description: Paste the complete output of `wavec --version`. + placeholder: wavec ... + validations: + required: true + - type: input + attributes: + label: Host and hardware + description: Operating system, architecture, CPU, and memory. + validations: + required: true + - type: input + attributes: + label: Target triple and optimization + placeholder: x86_64-unknown-linux-gnu, -O2 + validations: + required: true + - type: dropdown + attributes: + label: Affected metric + options: + - Compiler time + - Compiler memory + - Generated-code runtime + - Generated-code size + - Link time + - Other + validations: + required: true + - type: textarea + attributes: + label: Reproduction and measurement method + description: Include the source or repository, exact commands, number of runs, and measurement tool. + validations: + required: true + - type: textarea + attributes: + label: Baseline and observed result + description: Provide both values, including units and compiler revisions when comparing commits. + validations: + required: true + - type: textarea + attributes: + label: Profiles and additional context + description: Attach profiles, traces, generated IR/assembly, or other evidence when available. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..f900829e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ +## Summary + + + +## Motivation + + + +## Target and compatibility impact + + + +## Validation + + + +## Checklist + +- [ ] Commits include a DCO `Signed-off-by` line. +- [ ] Tests cover new behavior or the PR explains why no test is needed. +- [ ] User-facing changes include documentation or diagnostics updates. +- [ ] The change preserves the license boundary between the compiler and `std/`. diff --git a/.github/doom-demo.gif b/.github/doom-demo.gif deleted file mode 100644 index 8b5da655..00000000 Binary files a/.github/doom-demo.gif and /dev/null differ diff --git a/.github/scalability.svg b/.github/scalability.svg deleted file mode 100644 index 7e310118..00000000 --- a/.github/scalability.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.github/scalability1.svg b/.github/scalability1.svg deleted file mode 100644 index a640386e..00000000 --- a/.github/scalability1.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/README.md b/README.md index abf0697e..45306c1f 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,168 @@
- -Wave Programming Language Logo - -
-

Wave

-

Systems Programming Language

- - -

-Created by LunaStev -

- -

-Website · -Docs · -Blog · -Community -

-
- -Latest version - - -Build Status - - -Discord - - -Licenses - -
+ + Wave programming language logo + + +

Wave

+ +

A systems programming language for explicit native software.

+

Direct control, predictable code generation, and practical interoperability from hosted applications to freestanding systems.

+ +

+ Website · + Documentation · + Releases · + Community · + Sponsor +

+ +

+ Build status + Latest release + Sponsor Wave on OpenCollective +

---- +## Why Wave? -The information about this project is official and can be found on the [TechPedia Wiki](https://techpedia.wiki/) and the [official website](https://wave-lang.dev/). +Wave is built for software where the machine matters. It combines familiar structured programming with explicit low-level facilities and native target control. ---- +- **Native by design.** Compile to executables, objects, assembly, LLVM IR, or bitcode. +- **Low-level when needed.** Use pointers, C ABI boundaries, inline assembly, and freestanding targets when system contracts must stay visible. +- **Structured language features.** Build with functions, generics, structs, enums, `proto`, arrays, and explicit mutable or immutable bindings. +- **Cross-target compilation.** Generate code for x86-64, AArch64, and RISC-V 64 from supported compiler hosts. +- **Tool-friendly interfaces.** Query targets and compiler capabilities in human-readable or JSON form for build tools and editors. -## 🚀 Quick Start +Wave is under active pre-beta development. Syntax and toolchain contracts are being stabilized and may still change between releases. -```bash -curl -fsSL https://wave-lang.dev/install.sh | bash -s -- latest -``` +## A first Wave program ---- +```wave +fun main() { + let language: str = "Wave"; + var count: i32 = 1; -## About Wave + println("Hello from {} #{}", language, count); +} +``` -Wave is a systems programming language designed for low-level control and high performance. -It has no builtin functions — all functionality is provided through the standard library. +Save this as `main.wave`, then run it directly: -```kotlin -fun main() { - println("Hello World"); -} +```shell +wavec run main.wave ``` ---- +## Install -## Build From Source +Linux and macOS: -```bash -git clone https://github.com/wavefnd/Wave.git -cd Wave -cargo build +```shell +curl -fsSL https://wave-lang.dev/install.sh | bash -s -- latest ``` -Compiler binary path: +Windows PowerShell: -- `target/debug/wavec` (development build) -- `target/release/wavec` (release build) - ---- +```powershell +irm https://wave-lang.dev/install.ps1 -OutFile install.ps1 +powershell -ExecutionPolicy Bypass -File .\install.ps1 -Latest +``` -## Platform Support +See the [installation guide](https://wave-lang.dev/docs/getting-started/install) for platform requirements and release selection. -Wave separates the platform that runs the compiler from the platform that the -compiler generates code for. +## Use `wavec` -The `wavec` compiler is intended to run on Linux, macOS, and Windows. Release -packages bundle the LLVM components needed by the compiler so users do not need -to install LLVM manually. +```shell +# Check without producing a binary. +wavec check main.wave -Wave can generate native hosted programs when the target linker, system -libraries, and sysroot are available. It can also generate freestanding objects -for kernels, bootloaders, firmware, and other no-OS environments with -`--freestanding`. +# Build and run. +wavec run main.wave -- arg1 arg2 -WaveOS is developed as a freestanding target. The current workflow is to run -`wavec` on a host OS and emit WaveOS boot or kernel artifacts. Running the -compiler inside WaveOS itself is a later hosted-compiler milestone. +# Build an optimized hosted executable. +wavec -O2 build main.wave -o app ---- +# Emit a freestanding RISC-V object. +wavec --target=riscv64-unknown-none-elf build kernel.wave --freestanding --emit=obj +``` -## CLI Usage +The compiler exposes its current capabilities instead of requiring tools to maintain hard-coded lists: -```bash -wavec run -wavec build -wavec build -o -wavec build -c +```shell +wavec print supported-targets +wavec print supported-input-types +wavec print supported-emit-kinds +wavec print target-spec --target riscv64-unknown-linux-gnu --format=json ``` -Useful global options: +Run `wavec --help` for the complete CLI contract. -- `-O0..-O3`, `-Os`, `-Oz`, `-Ofast` -- `--debug-wave=tokens,ast,ir,mc,hex,all` -- `--link=` -- `-L ` -- `--dep-root=` -- `--dep==` +## Target families ---- +| Architecture | Hosted targets | Freestanding target | +| --- | --- | --- | +| x86-64 | Linux GNU, macOS, Windows GNU | `x86_64-unknown-none-elf` | +| AArch64 | Linux GNU, macOS | `aarch64-unknown-none-elf` | +| RISC-V 64 | Linux GNU | `riscv64-unknown-none-elf` | -## Contributing +Hosted cross-linking requires a compatible linker, system libraries, and sysroot for the selected target. Freestanding builds omit the default hosted runtime assumptions and are intended for kernels, firmware, boot code, and other no-OS environments. -Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) before submitting a pull request. +## Build from source ---- +Follow the [Wave development setup](https://github.com/wavefnd/setup), then build with the locked dependency graph: -## License +```shell +git clone https://github.com/wavefnd/Wave.git +cd Wave +cargo build --locked +``` -- The Wave compiler and repository components outside [`std/`](std/) are - licensed under the [Mozilla Public License 2.0](LICENSE). -- The Wave standard library under [`std/`](std/) is licensed separately under - the [Apache License 2.0](std/LICENSE), allowing it to be modified, - redistributed, and embedded in other products under that license. +The development compiler is written to `target/debug/wavec`. Before submitting compiler changes, run: ---- +```shell +cargo fmt --all --check +cargo test --locked --all-targets +cargo clippy --locked --all-targets -- -D warnings +python3 tools/run_tests.py +``` -## What can do? +## Ecosystem -Check https://github.com/wavefnd/Wave/issues/328 to see useful programs created with Wave. +| Project | Role | +| --- | --- | +| [Wave](https://github.com/wavefnd/Wave) | Language frontend, compiler driver, LLVM backend, and standard library source | +| [Vex](https://github.com/wavefnd/Vex) | Manifest-based package manager and build tool | +| [Whale](https://github.com/wavefnd/Whale) | Native assembler, object tooling, and linker under development | ---- +Useful project references: -## Sponsor +- [Language documentation](https://wave-lang.dev/docs/) +- [Examples](examples/) +- [Contributing guide](CONTRIBUTING.md) +- [Versioning policy](VERSION.md) +- [Release process](RELEASING.md) +- [Issue tracker](https://github.com/wavefnd/Wave/issues) - -Sponsor - +## Contributing ---- +Contributions are welcome through GitHub pull requests and email patches. Read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting changes; all commits require a DCO `Signed-off-by` line. + +## License + +- The compiler and repository components outside [`std/`](std/) are licensed under the [Mozilla Public License 2.0](LICENSE). +- The standard library in [`std/`](std/) is licensed separately under the [Apache License 2.0](std/LICENSE), allowing modification, redistribution, and embedding under that license. + +## Sponsors + +Wave is developed in public with support from individuals and organizations. You can contribute monthly or once through [OpenCollective](https://opencollective.com/wave-lang/contribute). + +

+ + Wave sponsors + +
+ + Wave backers + +

-

Built with ❤️ by the Wave community
© 2025 Wave Programming Language • LunaStev • Compiler: MPL-2.0 • Standard library: Apache-2.0

+Thank you to everyone who contributes code, documentation, testing, funding, or time to Wave.