Install and compile NaC in minutes. Start building amazing things.
Before installing NaC, make sure you have the following:
gcc --version to verify your GCC installation.
Clone the repository from GitHub:
git clone https://github.com/naclang/nac.git
cd
nac
Compile the NaC interpreter using GCC:
# Using MinGW
./build.bat
# Add to PATH (optional)
set PATH=%PATH%;C:\path\to\nac# Make executable
chmod +x build.sh
# Optional: Install system-wide
./build.sh
# Optional: Install system-wide
sudo cp nac /usr/local/bin/Run your first NaC program:
./nac examples/test.nac
Explore the examples directory for more sample programs:
# Factorial calculation
./nac examples/factorial.nac
# Number guessing game
./nac examples/guess.nac
# Prime number check
./nac examples/prime.nac
# Fibonacci sequence
./nac examples/fibonacci.nac
# HTTP example
./nac examples/http.nac
# Array operations
./nac examples/arrays.nac
# Sorting algorithm
./nac examples/bubble_sort.nac
Advanced compilation options for optimization:
gcc -g -o...
gcc -O3...
gcc -static...
-lm flag when compiling.
sudo apt install build-essentialsudo dnf install gccxcode-select --install
chmod +x nac to make the binary executable.
Now that you have NaC installed, here's what to do next: