Install
Quick Start (macOS Apple Silicon)
# Install
curl -L https://raw.githubusercontent.com/Nerd-Lang/nerd-lang-core/main/bin/nerd-darwin-arm64 -o nerd
chmod +x nerd
# Write a program
echo 'fn add a b
ret a plus b
fn mul a b
ret a times b' > math.nerd
# Run it
./nerd run math.nerd
# Output:
# add = 8
# mul = 15
From Source
git clone https://github.com/Nerd-Lang/nerd-lang-core.git
cd nerd-lang-core/bootstrap
make
sudo make install
Prerequisites
NERD compiles to LLVM IR. You need clang to build native binaries.
macOS
xcode-select --install
# or
brew install llvm
Linux
# Ubuntu/Debian
sudo apt install build-essential clang
# Fedora
sudo dnf install clang gcc make
# Arch
sudo pacman -S clang gcc make
Windows
winget install LLVM.LLVM
Usage
# Compile to LLVM IR
nerd compile program.nerd -o program.ll
# Build native binary
clang -O2 program.ll -o program
Example
fn add a b
ret a plus b
fn mul a b
ret a times b
cd bootstrap
./nerd compile ../examples/math.nerd -o math.ll
cat math.ll test_math.ll > combined.ll
clang -O2 combined.ll -o math
./math
Commands
nerd compile <file> -o <out> | Compile to LLVM IR |
nerd parse <file> | Show AST |
nerd tokens <file> | Show tokens |
nerd --version | Version |