/Zura-Transpiled

The is a low-level compiled language

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Zura: a low-level compiled alternative to C and C++

Why? | Goals | Status | Getting Started | Usage | Join Us

Introduction

Zura is a statically typed, compiled, low-level programming language. It is designed to be simple and easy to use. It is inspired by C and Go. It is currently in development and is not ready for production use.

Why

C++ remains the dominant programming language for performance-critical software, with massive and growing codebases and investments. However, it is struggling to improve and meet developers' needs, as outlined above, in no small part due to accumulating decades of technical debt. Incrementally improving C++ is extremely difficult, both due to the technical debt itself and challenges with its evolution process. The best way to address these problems is to avoid inheriting the legacy of C or C++ directly, and instead start with solid language foundations like modern generics system, modular code organization, and consistent, simple syntax.

Existing modern languages already provide an excellent developer experience: Go, Swift, Kotlin, Rust, and many more. Developers that can use one of these existing languages should. Unfortunately, the designs of these languages present significant barriers to adoption and migration from C++. These barriers range from changes in the idiomatic design of software to performance overhead.

Zura is fundamentally a successor language approach, rather than an attempt to incrementally evolve C++. It is designed around interoperability with C++ as well as large-scale adoption and migration for existing C++ codebases and developers. A successor language for C++ requires:

  • Performance matching C++, an essential property for developers.
  • Seamless, bidirectional interoperability with C++, such that a library anywhere in an existing C++ stack can adopt Zura without porting the rest.
  • A gentle learning curve with reasonable familiarity for C++ developers.
  • Comparable expressivity and support for existing software's design and architecture.

Zura aims to fill an analogous role for C++:

  • JavaScript → TypeScript
  • Java → Kotlin
  • C++ → Zura

Language Goals

I am designing Zura to support:

  • Performance-critical software
  • Software and language evolution
  • Code that is easy to read, understand, and write
  • Practical safety and testing mechanisms
  • Fast and scalable development
  • Modern OS platforms, hardware architectures, and environments

While many languages share subsets of these goals, what distinguishes Zura is their combination.

I also have explicit non-goals for Zura, notably including:

My detailed goals document fleshes out these ideas and provides a deeper view into my goals for the Zura project and language.

Project Status

Zura Language is currently an experimental project. There is no working compiler or toolchain. The demo interpreter for Zura is coming soon

I want to better understand whether I can build a language that meets a successor language criteria, and whether the resulting language can gather a critical mass of interest within the larger C++ industry and community.

Currently, I have fleshed out several core aspects of both Zura the project and the language:

  • The strategy of the Zura Language and project.
  • An open-source project structure, governance model, and evolution process.

You can see my full roadmap for more details.

Getting Started

To start make sure you have the following installed:

Building Locally

Windows

Commands to install the above packages on Windows:

# Install chocolatey
> Set-ExecutionPolicy Bypass -Scope Process -Force; `
  iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install packages
> choco install cmake make mingw ninja

Linux

Commands to install the above packages on Ubuntu and Debian:

$ sudo apt-get install cmake make gcc ninja-build valgrind

For Arch Linux:

$ sudo pacman -S cmake make gcc ninja valgrind 
Building

Now if you want to build zura for the debug mode do

$ mkdir debug
$ cd debug
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
$ make

and now the exacutable will be available for you to use to debug with

Or if you want the release version do this

$ mkdir build
$ cd build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
$ make

This will create a zura executable in the build directory.

Or you can alternativly use the build.sh file to do this for you

$ chmod +x build.sh
$ ./build.sh debug or ./build.sh release

Or you can download the latest release from here and add either the zura.exe (For Windows) or zura (For Linux) executable to your path. Eventually, I will add a script to automate this process.

Now feel free to go take a look at the documentation to see how to use the language. Documentation

Development env

This Dockerfile sets up a basic development environment with the necessary compilers, build tools, and utilities for developing the Zura language. It also includes Vim and Emacs as text editors for code editing directly within the container. The final command (CMD ["/bin/bash"]) opens a bash shell when the container starts, allowing you to run build commands, edit files, or use version control directly inside the container.

Build the Docker image:

$ docker build -t zura-dev .

Run the Docker container, mounting the current directory for development:

$ docker run -it --rm -v $(pwd):/usr/src/app zura-dev

TODO: publish to docker hub

This setup mounts the current directory to /usr/src/app inside the container, allowing you to develop on your host machine while running and testing inside the container.

Usage

$ ./build/zura <filename> -o <output name>

if you wish to save the c code to a file, use the -s flag:

$ ./build/zura <filename> -o <output name> -s

if you want to clean up the build directory, use the -c flag:

$ ./build/zura -c <exactable name>

Then run the output file with:

$ ./<output name>

Command that you can run

$ zura --help

This command will show you all of the commands that you can run in the zura compiler.

Example of syntax and errors

not yet done

Join Us!

Zura Website