{"id":13607909,"url":"https://github.com/alumina-lang/alumina","last_synced_at":"2025-04-12T14:31:31.207Z","repository":{"id":36998418,"uuid":"426451834","full_name":"alumina-lang/alumina","owner":"alumina-lang","description":"A general purpose programming language","archived":false,"fork":false,"pushed_at":"2025-02-24T20:05:36.000Z","size":9834,"stargazers_count":189,"open_issues_count":1,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-10T06:47:27.628Z","etag":null,"topics":["compiler","programming-language"],"latest_commit_sha":null,"homepage":"https://docs.alumina-lang.net","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alumina-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-11-10T02:01:10.000Z","updated_at":"2025-04-06T14:17:32.000Z","dependencies_parsed_at":"2023-02-13T20:46:30.016Z","dependency_job_id":"8afbf105-5597-4536-a602-2f3b4fdc76c9","html_url":"https://github.com/alumina-lang/alumina","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumina-lang%2Falumina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumina-lang%2Falumina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumina-lang%2Falumina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumina-lang%2Falumina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alumina-lang","download_url":"https://codeload.github.com/alumina-lang/alumina/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581162,"owners_count":21128112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","programming-language"],"created_at":"2024-08-01T19:01:22.710Z","updated_at":"2025-04-12T14:31:31.186Z","avatar_url":"https://github.com/alumina-lang.png","language":"Rust","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Alumina Programming Language\n\nAlumina is an imperative, general-purpose, statically typed, compiled system programming language.\n\nNon-exhaustive list of distinguishing features:\n\n- Module system and 2-pass compilation (no header files and forward declarations needed)\n- Generics (duck-typed, similar to C++ templates but without SFINAE), protocols and mixins\n  - Specialization is possible with `when` expressions\n  - Opt-in dynamic polymorphism with dynamic dispatch ([`dyn` pointers](./examples/dyn.alu))\n- Limited operator overloading (via `Equatable` and `Comparable` protocols)\n- Block expressions\n- Anonymous functions (including closures)\n- Richer type system:\n  - strong enums,\n  - array slices,\n  - named function types,\n  - tuples,\n  - first-class 0-sized types (unit/void, 0-sized arrays, structs with no fields, ...),\n  - never type\n- Hygienic expression macros\n- [Stackful coroutines](./examples/coroutines.alu)\n- [Compile-time constant evaluation](./examples/constants.alu) (including loops, function calls, etc.)\n- [Unified call syntax](https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax) for functions and macros in scope\n- [Defer expressions](./examples/defer_and_move.alu)\n- [Compile-time reflection and meta-programming](./examples/reflection.alu)\n\nAlumina is heavily inspired by Rust, especially in terms of syntax and standard library API. Unlike Rust, however, Alumina is not memory-safe and it requires manual memory management.\n\n# Quick links\n\n- [Language guide](./docs/lang_guide.md)\n- [Library documentation](https://docs.alumina-lang.net)\n- [Online compiler playground](https://play.alumina-lang.net)\n\n# Motivating example\n\n\u003c!-- github, add syntax highlighting for Alumina pls --\u003e\n```rust\nstruct Stack\u003cT\u003e {\n   data: \u0026mut [T],\n   len: usize,\n}\n\nimpl Stack\u003cT\u003e {\n   use std::mem::slice;\n\n   fn new() -\u003e Stack\u003cT\u003e {\n      with_capacity(0)\n   }\n\n   fn with_capacity(capacity: usize) -\u003e Stack\u003cT\u003e {\n      Stack {\n         data: slice::alloc(capacity),\n         len: 0,\n      }\n   }\n\n   fn reserve(self: \u0026mut Stack\u003cT\u003e, additional: usize) {\n      use std::cmp::max;\n\n      if self.len + additional \u003e self.data.len() {\n         self.data = self.data.realloc(max(\n            self.data.len() * 2,\n            self.len + additional\n         ));\n      }\n   }\n\n   fn push(self: \u0026mut Stack\u003cT\u003e, value: T) {\n      self.reserve(1);\n      self.data[self.len] = value;\n      self.len += 1;\n   }\n\n   fn pop(self: \u0026mut Stack\u003cT\u003e) -\u003e T {\n      self.len -= 1;\n      self.data[self.len]\n   }\n\n   fn is_empty(self: \u0026Stack\u003cT\u003e) -\u003e bool {\n      self.len == 0\n   }\n\n   fn free(self: \u0026mut Stack\u003cT\u003e) {\n      self.data.free();\n   }\n}\n\nfn main() {\n   let v: Stack\u003c\u0026[u8]\u003e = Stack::new();\n   defer v.free();\n\n   v.push(\"Stack.\\n\");\n   v.push(\"a \");\n   v.push(\"am \");\n   v.push(\"I \");\n\n   while !v.is_empty() {\n       print!(\"{}\", v.pop());\n   }\n}\n```\n\n# Status\n\nBootstrap Alumina compiler ([`alumina-boot`](./src/alumina-boot)) is written in Rust and is actively developed. It compiles to ugly C11 code with GCC extensions (works on Clang too).\n\nFinished:\n\n- Lexical analysis and parser (using Tree-Sitter)\n- Scope/name resolution\n- Type support\n- Lowering parse tree into AST (desugaring, macro expansion, ...)\n- Lowering AST into IR (with monomorphization, type checking and semantic analysis)\n- Basic optimizations (ZST elision, dead code elimination)\n- Codegen to C11\n- A full-featured [standard library](https://docs.alumina-lang.net/std)\n    - [heap-allocating collections](https://docs.alumina-lang.net/std/collections) (vector, hashmap, hashset, deque)\n    - [iterator combinators](https://docs.alumina-lang.net/std/iter)\n    - [string functions and formatting](https://docs.alumina-lang.net/std/string)\n    - [spawning processes](https://docs.alumina-lang.net/std/process)\n    - [standard, file and pipe I/O](https://docs.alumina-lang.net/std/io)\n    - [multithreading](https://docs.alumina-lang.net/std/thread)\n    - [synchronization primitives and atomics](https://docs.alumina-lang.net/std/sync)\n    - [basic filesystem operations](https://docs.alumina-lang.net/std/fs)\n    - [TCP/IP sockets](https://docs.alumina-lang.net/std/net)\n    - [random number generation](https://docs.alumina-lang.net/std/random)\n    - [unit testing framework](https://docs.alumina-lang.net/test)\n    - [reflection](https://docs.alumina-lang.net/std/typing)\n\nTo be done:\n\n- Standard library is only usable on Unixes (tested on Linux, macOS and Android)\n- Compiler driver (something like Rust's `cargo`)\n- A good story for third-party libraries (something like `crates.io` maybe?)\n- Various rough edges, bugs and missing features\n\nFull list of missing features, open questions, bugs and ideas for the future is in [MISSING.md](./MISSING.md)\n\n# Try it out\n\nDon't want to install anything? Try https://play.alumina-lang.net, an online compiler playground.\n\nYou can do it with Podman/Docker:\n\n```bash\n# With Podman\nalias alumina-boot='podman run -v $(pwd):/workspace ghcr.io/alumina-lang/alumina-boot:latest'\n# With Docker\nalias alumina-boot='docker run -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/workspace ghcr.io/alumina-lang/alumina-boot:latest'\n\nalumina-boot hello_world=./examples/hello_world.alu -o hello.c\ncc hello.c -o hello\n./hello\n```\n\nOtherwise, follow the instructions to build it from source.\n\n## Prerequisites\n\nTo compile `alumina-boot` compiler from source, these prerequisites are needed:\n\n  - A C compiler (GCC or Clang) and Make\n  - A Rust toolchain (`rustup install stable`)\n  - Node.js and Tree-sitter CLI (`npm install -g tree-sitter-cli` or `cargo install tree-sitter-cli`)\n\nAdditionally, to compile the tools, such as `alumina-doc`, these prerequisites are needed:\n\n  - Tree-sitter runtime library (`libtree-sitter.a`/`libtree-sitter.so`):\n   ```bash\n   git clone https://github.com/tree-sitter/tree-sitter\n   cd tree-sitter\n   make\n   sudo make install\n   # sudo ldconfig\n   ```\n  - [`libbacktrace`](https://github.com/ianlancetaylor/libbacktrace/) is an optional dependency for nice stack backtraces on panics. If disabled, pass `STD_BACKTRACE=1` when building `aluminac` to use the libc's backtrace function instead.\n   ```bash\n   git clone https://github.com/ianlancetaylor/libbacktrace\n   cd libbacktrace\n   ./configure\n   make\n   sudo make install\n   ```\n\n## Building\n\nTo compile `alumina-boot` compiler from source, run:\n```\nmake alumina-boot\n```\n\nNow you are able to compile Alumina code, e.g.\n\n```\n./alumina-boot --sysroot ./sysroot hello_world=./examples/hello_world.alu -o hello_world.c\ncc hello_world.c -o hello_world\n./hello_world\n```\n\nIf you wish to run the tests, simply add `--cfg test`. In this case the `main()` function will be replaced by the test runner.\n\n```\n./alumina-boot --sysroot ./sysroot hello_world=./examples/hello_world.alu -o hello_world_test.c\ncc hello_world_test.c -o hello_world_test\n./hello_world_test\n```\n\nIf you wish to compile with multithreading enabled, add `--cfg threading` and link with `libpthread`.\n\n```\n./alumina-boot --cfg threading --sysroot ./sysroot hello_world=./examples/threading.alu -o threading.c\ncc threading.c -o threading -lpthread\n./threading\n```\n\n\nTo compile the self-hosted compiler, run:\n```\nmake aluminac\n```\n\nSee the [language guide](./docs/lang_guide.md), assorted [examples](./examples), [standard library](./sysroot) for a tour of the language.\n\n\n# Contributing\n\nIssues, pull requests, and feature requests are most welcome. Standard library is covered with tests, and there are also documentation tests (all examples from the standard library are compiled and executed as test cases).\n\nTo run the standard library tests\n\n```shell\nmake test-std\n```\n\nTo run the documentation tests\n\n```shell\nmake test-docs\n```\n\nStandard library contributions are especially welcome! Ideas for contribution:\n\n- Better / more performant algorithms and collections (sorting, HashMap, ...)\n- Port the standard library to other platforms (e.g. Windows) or libc implementations (on Linux only glibc is supported, musl would be very nice to have)\n- Unix domain socket support\n- More test cases and documentation / example code for existing functionality\n\n## Projects using Alumina\n\nNeedless to say, a great way to contribute to the project is to just use Alumina for your own programs and libraries. Submit a PR and add your project to the list:\n\n- [timestamped](http://github.com/tibordp/timestamped) - A utility to record and replay the output of a program with timestamps.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falumina-lang%2Falumina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falumina-lang%2Falumina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falumina-lang%2Falumina/lists"}