https://github.com/tibordp/alumina Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Copilot + Packages + Security + Code review + Issues + Discussions + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Skills + GitHub Sponsors + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} tibordp / alumina Public * Notifications * Fork 1 * Star 30 A general purpose programming language docs.alumina-lang.net License MIT license 30 stars 1 fork Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights tibordp/alumina This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 16 branches 0 tags Code * Clone HTTPS GitHub CLI [https://github.com/t] Use Git or checkout with SVN using the web URL. [gh repo clone tibord] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @tibordp tibordp docs: Documentation improvements (#48) ... cbc3c15 Sep 3, 2022 docs: Documentation improvements (#48) * docs: Documentation improvements * fix * fix * Upgrade tree-sitter cbc3c15 Git stats * 123 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .devcontainer chore: Add Codespaces configuration Jul 20, 2022 .github/workflows docs: Documentation improvements (#48) Sep 2, 2022 .vscode docs: More autodocs Jun 19, 2022 common docs: Language guide (#47) Sep 1, 2022 docs docs: Documentation improvements (#48) Sep 2, 2022 examples docs: Documentation improvements (#48) Sep 2, 2022 libraries chore: Make Option/Result fields private (#41) Aug 22, 2022 src docs: Documentation improvements (#48) Sep 2, 2022 sysroot docs: Documentation improvements (#48) Sep 2, 2022 tools docs: Documentation improvements (#48) Sep 2, 2022 .dockerignore fix: Stdlib bugfixes + math functions (#12) Jun 12, 2022 .gitignore docs: Even more documentation (#17) Jun 21, 2022 Cargo.lock docs: Documentation improvements (#48) Sep 2, 2022 Cargo.toml feat: Start working on the self-hosted compiler (#2) Jan 6, 2022 Dockerfile docs: Documentation improvements (#48) Sep 2, 2022 LICENSE.md chore: Add Codespaces configuration Jul 20, 2022 MISSING.md docs: Language guide (#47) Sep 1, 2022 Makefile docs: Documentation improvements (#48) Sep 2, 2022 README.md docs: Documentation improvements (#48) Sep 2, 2022 View code [ ] Alumina Programming Language Quick links Motivating example Status Try it out Prerequisites Building Contributing Projects using Alumina README.md Alumina Programming Language Alumina is an imperative, general-purpose, statically typed, compiled system programming language. Non-exhaustive list of distinguishing features: * Module system and 2-pass compilation (no header files and forward declarations needed) * Generics, protocols and mixins (duck-typed, similar to C++ templates but without overloading/SFINAE) + Specialization is possible with when expressions + Opt-in dynamic polymorphism with dynamic dispatch (dyn pointers) * Unified call syntax for functions in scope * Limited operator overloading (via Equatable and Comparable protocols) * Block expressions * Anonymous functions (including closures) * Richer type system: + strong enums, + array slices, + tuples, + first-class 0-sized types (unit/void, function types, 0-sized arrays, structs with no fields, ...), + never type * Hygenic expression macros * Go-style defer expressions Alumina 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. Quick links * Language guide * Library documentation * Online compiler playground Motivating example struct Stack { data: &mut [T], len: usize, } impl Stack { use std::mem::slice; fn new() -> Stack { with_capacity(0) } fn with_capacity(capacity: usize) -> Stack { Stack { data: slice::alloc(capacity), len: 0, } } fn reserve(self: &mut Stack, additional: usize) { use std::cmp::max; if self.len + additional > self.data.len() { self.data = self.data.realloc(max( self.data.len() * 2, self.len + additional )); } } fn push(self: &mut Stack, value: T) { self.reserve(1); self.data[self.len] = value; self.len += 1; } fn pop(self: &mut Stack) -> T { self.len -= 1; self.data[self.len] } fn is_empty(self: &Stack) -> bool { self.len == 0 } fn free(self: &mut Stack) { self.data.free(); } } fn main() { let v: Stack<&[u8]> = Stack::new(); defer v.free(); v.push("Stack.\n"); v.push("a "); v.push("am "); v.push("I "); while !v.is_empty() { print!("{}", v.pop()); } } Status Bootstrap Alumina compiler (alumina-boot) is written in Rust and is actively developed. It compiles to ugly C11 code with GCC extensions (works on Clang too). Finished: * Lexical analysis and parser (using Tree-Sitter) * Scope/name resolution * Type support * Lowering parse tree into AST (desugaring, macro expansion, ...) * Lowering AST into IR (with monomorphization, type checking and semantic analysis) * Basic optimizations (ZST elision, dead code elimination) * Codegen to C11 * A full-featured standard library + heap-allocating collections (vector, hashmap, hashset, deque) + iterator combinators + string functions and formatting + spawning processes + standard, file and pipe I/O + multithreading + synchronization primitives and atomics + basic filesystem operations + TCP/IP sockets + random number generation + unit testing framework To be done: * Standard library is only usable on Unixes (tested on Linux, macOS and Android) * Compiler driver (something like Rust's cargo) * A good story for third-party libraries (something like crates.io maybe?) * Various rough edges and missing features A self-hosted compiler (aluminac) is also being written. It is in very early stages (is only able to parse source at the moment). It will eventually have a LLVM backend. Full list of missing features, open questions, bugs and ideas for the future is in MISSING.md Try it out Don't want to install anything? Try https://play.alumina-lang.net, an online compiler playground. You can do it with Podman/Docker: # With Podman alias alumina-boot='podman run -v $(pwd):/workspace ghcr.io/tibordp/alumina-boot:latest' # With Docker alias alumina-boot='docker run -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/workspace ghcr.io/tibordp/alumina-boot:latest' alumina-boot hello_world=./examples/hello_world.alu -o hello.c cc hello.c -o hello ./hello Otherwise, follow the instructions to build it from source. Prerequisites To compile alumina-boot compiler from source, these prerequisites are needed: * A C compiler (GCC or Clang) and Make * A Rust toolchain (rustup install stable) * Node.js and Tree-sitter CLI (npm install -g tree-sitter-cli or cargo install tree-sitter-cli) Additionally, to compile aluminac, these prerequisites are needed: * LLVM 13 shared libraries and headers (llvm-13-dev) * Tree-sitter runtime library (libtree-sitter.a/libtree-sitter.so): git clone https://github.com/tree-sitter/tree-sitter cd tree-sitter make sudo make install # sudo ldconfig Building To compile alumina-boot compiler from source, run: make alumina-boot Now you are able to compile Alumina code, e.g. ./alumina-boot --sysroot ./sysroot hello_world=./examples/hello_world.alu -o hello_world.c cc hello_world.c -o hello_world ./hello_world If you wish to run the tests, simply add --cfg test. In this case the main() function will be replaced by the test runner. ./alumina-boot --sysroot ./sysroot hello_world=./examples/hello_world.alu -o hello_world_test.c cc hello_world_test.c -o hello_world_test ./hello_world_test If you wish to compile with multithreading enabled, add --cfg threading and link with libpthread. ./alumina-boot --cfg threading --sysroot ./sysroot hello_world=./examples/threading.alu -o threading.c cc threading.c -o threading -lpthread ./threading To compile the self-hosted compiler, run: make aluminac See the language guide, assorted examples, standard library and the self-hosted compiler for a tour of the language. Contributing Issues, 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). To run the standard library tests make test-std To run the documentation tests make test-docs Standard library contributions are especially welcome! Ideas for contribution: * Native floating point parsing and formatting (e.g. port Grisu3 to Alumina) * Better / more performant algorithms and collections (sorting, HashMap, ...) * 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) * Unix domain socket support * More test cases and documentation / example code for existing functionality Projects using Alumina Needless 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: * timestamped - A utility to record and replay the ouptut of a program with timestamps. About A general purpose programming language docs.alumina-lang.net Topics programming-language compiler Resources Readme License MIT license Stars 30 stars Watchers 3 watching Forks 1 fork Releases No releases published Packages 1 Languages * Rust 91.8% * JavaScript 5.2% * Makefile 1.3% * CSS 1.1% * Dockerfile 0.3% * C 0.2% * Shell 0.1% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.