Install Zap
Install the latest Zap toolchain with zapup:
curl --proto '=https' --tlsv1.2 -sSf https://zaplang.xyz/install.sh | shCheck the compiler installation:
zapc --versionzapc --print-stdlib-pathThe second command is useful when configuring an editor or diagnosing a custom installation.
Install Thor
Section titled “Install Thor”Use Thor to create, build, and run Zap applications. Install it after zapc:
git clone https://github.com/thezaplang/thorcd thor./build.shsudo cp build/thor /usr/local/bin/thorthor --versionThor invokes the installed zapc; it does not keep a second copy of the Zap
standard library. See Thor build tool for project
configuration and dependencies.
Build from source
Section titled “Build from source”A source build requires:
- a C++20 compiler
- LLVM development libraries
- CMake 3.20 or newer
- Git
Clone and build the repository:
git clone https://github.com/thezaplang/zap.gitcd zap./build.shThe compiler is written to build/zapc. Build Thor from the repository’s
pinned submodule and use it for programs:
git submodule update --init tools/thorcd tools/thorPATH="../../build:$PATH" ./build.sh./build/thor new hellocd hello../../build/thor runFor daily use, place both build/zapc and tools/thor/build/thor on your
PATH. zapc remains useful for editor configuration and low-level compiler
diagnostics; Thor is the normal application workflow.
Verify a development build
Section titled “Verify a development build”Run both test suites before changing the compiler:
ctest --test-dir build --output-on-failure./run_tests.py --zapc ./build/zapcContinue with Your first program.