Getting Started

This section will guide you through the initial steps of using the Ziv programming language, from installation to writing your first program.

Prerequisites

  • Operating System: Ziv is currently supported on Linux and macOS. Windows support is planned for a future release.

  • Dependencies: Ziv requires the following dependencies to be installed on your system:

    • clang (version 10 or later)
    • llvm (version 10 or later)
    • cmake (version 3.10 or later)
    • ninja (version 1.8 or later)

Ensure that these dependencies are installed before proceeding with the installation process.

Installation

Using Pre-built Binaries

Ziv provides pre-built binaries for major operating systems. Follow the steps below to install Ziv using the pre-built binaries:

  1. Download: Visit the Ziv Releases page and download the latest release for your operating system.

  2. Extract: Unzip the downloaded archive to a directory of your choice.

  3. Add to Path: Add the Ziv binary directory to your system's PATH environment variable to make it accessible from the command line.

Building from Source

If you prefer to build Ziv from source, follow the steps below:

  1. Clone the Repository: Clone the Ziv repository from GitHub using the following command:

    git clone https://github.com/ziv-language/ziv.git
    
  2. Build Ziv: Navigate to the cloned repository and run the following commands to build Ziv:

    cd ziv
    cmake -B build -G Ninja -S .
    cmake --build build
    
  3. Add to Path: Add the build/bin directory to your system's PATH environment variable to make the Ziv binary accessible from the command line.

Writing Your First Program

Now that you have installed Ziv, let's write a simple "Hello, World!" program to test your installation.

  1. Create a new file named hello.ziv with the following content:

    # hello.ziv
    fn main() -> void:
        print("Hello, World!")
    
  2. Save the file and run the following command in the terminal to compile and execute the program:

    zivc hello.ziv
    

You should see the output Hello, World! printed to the console. Congratulations! You have successfully written and executed your first Ziv program.