| ... | ... | @@ -3,137 +3,11 @@ |
| 3 | 3 | Zig is an open-source programming language designed for **robustness**, |
| 4 | 4 | **optimality**, and **maintainability**. |
| 5 | 5 | |
| 6 | | [Download & Documentation](https://ziglang.org/download/) |
| 7 | | |
| 8 | | ## Feature Highlights |
| 9 | | |
| 10 | | * Small, simple language. Focus on debugging your application rather than |
| 11 | | debugging knowledge of your programming language. |
| 12 | | * Ships with a build system that obviates the need for a configure script |
| 13 | | or a makefile. In fact, existing C and C++ projects may choose to depend on |
| 14 | | Zig instead of e.g. cmake. |
| 15 | | * A fresh take on error handling which makes writing correct code easier than |
| 16 | | writing buggy code. |
| 17 | | * Debug mode optimizes for fast compilation time and crashing with a stack trace |
| 18 | | when undefined behavior *would* happen. |
| 19 | | * ReleaseFast mode produces heavily optimized code. What other projects call |
| 20 | | "Link Time Optimization" Zig does automatically. |
| 21 | | * Compatible with C libraries with no wrapper necessary. Directly include |
| 22 | | C .h files and get access to the functions and symbols therein. |
| 23 | | * Provides standard library which competes with the C standard library and is |
| 24 | | always compiled against statically in source form. Zig binaries do not |
| 25 | | depend on libc unless explicitly linked. |
| 26 | | * Optional type instead of null pointers. |
| 27 | | * Safe unions, tagged unions, and C ABI compatible unions. |
| 28 | | * Generics so that one can write efficient data structures that work for any |
| 29 | | data type. |
| 30 | | * No header files required. Top level declarations are entirely |
| 31 | | order-independent. |
| 32 | | * Compile-time code execution. Compile-time reflection. |
| 33 | | * Partial compile-time function evaluation which eliminates the need for |
| 34 | | a preprocessor or macros. |
| 35 | | * The binaries produced by Zig have complete debugging information so you can, |
| 36 | | for example, use GDB, MSVC, or LLDB to debug your software. |
| 37 | | * Built-in unit tests with `zig test`. |
| 38 | | * Friendly toward package maintainers. Reproducible build, bootstrapping |
| 39 | | process carefully documented. Issues filed by package maintainers are |
| 40 | | considered especially important. |
| 41 | | * Cross-compiling is a primary use case. |
| 42 | | * In addition to creating executables, creating a C library is a primary use |
| 43 | | case. You can export an auto-generated .h file. |
| 44 | | |
| 45 | | ### Supported Targets |
| 46 | | |
| 47 | | #### Tier 1 Support |
| 48 | | |
| 49 | | * Not only can Zig generate machine code for these targets, but the standard |
| 50 | | library cross-platform abstractions have implementations for these targets. |
| 51 | | Thus it is practical to write a pure Zig application with no dependency on |
| 52 | | libc. |
| 53 | | * The CI server automatically tests these targets on every commit to master |
| 54 | | branch, and updates ziglang.org/download with links to pre-built binaries. |
| 55 | | * These targets have debug info capabilities and therefore produce stack |
| 56 | | traces on failed assertions. |
| 57 | | * ([coming soon](https://github.com/ziglang/zig/issues/514)) libc is available |
| 58 | | for this target even when cross compiling. |
| 59 | | |
| 60 | | #### Tier 2 Support |
| 61 | | |
| 62 | | * There may be some standard library implementations, but many abstractions |
| 63 | | will give an "Unsupported OS" compile error. One can link with libc or other |
| 64 | | libraries to fill in the gaps in the standard library. |
| 65 | | * These targets are known to work, but are not automatically tested, so there |
| 66 | | are occasional regressions. |
| 67 | | * Some tests may be disabled for these targets as we work toward Tier 1 |
| 68 | | support. |
| 69 | | |
| 70 | | #### Tier 3 Support |
| 71 | | |
| 72 | | * The standard library has little to no knowledge of the existence of this |
| 73 | | target. |
| 74 | | * Because Zig is based on LLVM, it has the capability to build for these |
| 75 | | targets, and LLVM has the target enabled by default. |
| 76 | | * These targets are not frequently tested; one will likely need to contribute |
| 77 | | to Zig in order to build for these targets. |
| 78 | | * The Zig compiler might need to be updated with a few things such as |
| 79 | | - what sizes are the C integer types |
| 80 | | - C ABI calling convention for this target |
| 81 | | - bootstrap code and default panic handler |
| 82 | | * `zig targets` is guaranteed to include this target. |
| 83 | | |
| 84 | | #### Tier 4 Support |
| 85 | | |
| 86 | | * Support for these targets is entirely experimental. |
| 87 | | * LLVM may have the target as an experimental target, which means that you |
| 88 | | need to use Zig-provided binaries for the target to be available, or |
| 89 | | build LLVM from source with special configure flags. `zig targets` will |
| 90 | | display the target if it is available. |
| 91 | | * This target may be considered deprecated by an official party, |
| 92 | | [such as macosx/i386](https://support.apple.com/en-us/HT208436) in which |
| 93 | | case this target will remain forever stuck in Tier 4. |
| 94 | | * This target may only support `--emit asm` and cannot emit object files. |
| 95 | | |
| 96 | | #### Support Table |
| 97 | | |
| 98 | | | | freestanding | linux | macosx | windows | freebsd | netbsd | UEFI | other | |
| 99 | | |-------------|--------------|--------|--------|---------|---------|------- | -------|--------| |
| 100 | | |x86_64 | Tier 2 | Tier 1 | Tier 1 | Tier 1 | Tier 2 | Tier 2 | Tier 2 | Tier 3 | |
| 101 | | |i386 | Tier 2 | Tier 2 | Tier 4 | Tier 2 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | |
| 102 | | |arm | Tier 2 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | |
| 103 | | |arm64 | Tier 2 | Tier 2 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | Tier 3 | |
| 104 | | |wasm32 | Tier 2 | N/A | N/A | N/A | N/A | N/A | N/A | Tier 2 | |
| 105 | | |bpf | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 106 | | |hexagon | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 107 | | |mips | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 108 | | |powerpc32 | Tier 3 | Tier 3 | Tier 4 | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 109 | | |powerpc64 | Tier 3 | Tier 3 | Tier 4 | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 110 | | |amdgcn | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 111 | | |sparc | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 112 | | |s390x | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 113 | | |lanai | Tier 3 | Tier 3 | N/A | N/A | Tier 3 | Tier 3 | N/A | Tier 3 | |
| 114 | | |wasm64 | Tier 4 | N/A | N/A | N/A | N/A | N/A | N/A | N/A | |
| 115 | | |avr | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 116 | | |riscv32 | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | Tier 4 | Tier 4 | |
| 117 | | |riscv64 | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | Tier 4 | Tier 4 | |
| 118 | | |xcore | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 119 | | |nvptx | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 120 | | |msp430 | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 121 | | |r600 | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 122 | | |arc | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 123 | | |tce | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 124 | | |le | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 125 | | |amdil | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 126 | | |hsail | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 127 | | |spir | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 128 | | |kalimba | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 129 | | |shave | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 130 | | |renderscript | Tier 4 | Tier 4 | N/A | N/A | Tier 4 | Tier 4 | N/A | Tier 4 | |
| 131 | | |
| 132 | | ## Community |
| 133 | | |
| 134 | | * IRC: `#zig` on Freenode ([Channel Logs](https://irclog.whitequark.org/zig/)). |
| 135 | | * Reddit: [/r/zig](https://www.reddit.com/r/zig) |
| 136 | | * Email list: [~andrewrk/ziglang@lists.sr.ht](https://lists.sr.ht/%7Eandrewrk/ziglang) |
| 6 | ## Resources |
| 7 | |
| 8 | * [Introduction](https://ziglang.org/#Introduction) |
| 9 | * [Download & Documentation](https://ziglang.org/download) |
| 10 | * [Community](https://github.com/ziglang/zig/wiki/Community) |
| 137 | 11 | |
| 138 | 12 | ## Building from Source |
| 139 | 13 | |