Programming language that compiles to Bash. It's a high level programming language that makes it easy to create shell scripts. It's particularly well suited for cloud services.
If shfmt it is present in the machine it will be used after the compilation to prettify the Bash code generated.
Warning
This software is not ready for extended usage.
Join our Discord or #amber-lang on irc.oftc.net (irc://irc.oftc.net/#amber-lang) or Join our Matrix room
Amber compiler currently works on:
- Linux x86 and ARM
- macOS x86 and ARM (Apple Silicon)
- Nix (NixOS)
Make sure that the operating system meets the following prerequisites
- Bourne-again shell (Bash)
- Curl tool for downloading the installation script
- Basic calculator
bc
command (On Debian runsudo apt install bc
)
curl -s "https://raw.githubusercontent.com/Ph0enixKM/AmberNative/master/setup/install.sh" | /bin/bash
curl -s "https://raw.githubusercontent.com/Ph0enixKM/AmberNative/master/setup/install.sh" | /bin/bash -s -- --user
Amber is packaged in the following distros:
Arch (AUR) - amber-bash-bin
See NIX.md
As windows does not come with bash installed it makes no sense to support it. Please install WSL 2 on your windows machine and install Linux version of Amber compiler inside.
In order for it to work you may need to run the following code that pulls all the prerequisites.
sudo apt install curl bc
sudo mkdir /opt /usr/local/bin
In order to contribute, you have to add couple of build targets:
rustup target add x86_64-unknown-linux-musl
rustup target add x86_64-apple-darwin
rustup target add x86_64-pc-windows-gnu
rustup target add aarch64-apple-darwin
And linkers (macos):
brew install messense/macos-cross-toolchains/aarch64-unknown-linux-musl
brew install messense/macos-cross-toolchains/x86_64-unknown-linux-gnu
Compile it:
git clone https://github.com/Ph0enixKM/Amber
cd Amber
cargo build
In order to build the installer scripts run:
amber build.ab
Debugging Amber:
// Shows the AST
AMBER_DEBUG_PARSER=true cargo run <file.ab>
// Shows the time it took to compile each phase
AMBER_DEBUG_TIME=true cargo run <file.ab>
// Flamegraph is a profiling tool that is used to visualize the time each function took to execute
sudo cargo flamegraph -- <file.ab> <file.sh>
We are using cargo-dist
to build the binaries for all the platforms. The binaries are then uploaded to the release page once a new release a tag is created.