Zig recently merged a PR called “make self-hosted the default compiler” – meaningThe default compiler is self-hosted. In programming languages, self-hosting means that the compiler implemented by the programming language can compile itself.So merging this PR means Zig has initially implemented bootstrapping.

As of Zig 0.10.x, developers can use the new self-hosted compiler by default.Of course, if you run into problems with the new compiler, add-fstage1 flag to get the old compiler.The development team says that between now and 0.10.0, they will do their best to fix real-world bugs and support as many third-party projects as possible with the new compiler.

According to Zig maintainers, the Zig self-hosted compiler has about 200,000 lines of code, including LLVM, WASM, C, x86_64, arm and aarch64 backends. The compiler code base is written in Zig instead of C++, using significantly less memory and optimizing performance.

From the description of the PR, many functions are still in the stage of implementation. Of course, the initial implementation of a self-hosted compiler is just one of the milestones for Zig, there is still a lot of important work to be done before 1.0 is released:

  1. Complete the self-hosted compiler.
  2. Stable language features, no more language feature changes
  3. Complete the first draft of the language specification
  4. Implement the official package manager
  5. Provide stable standard library
  6. Go through a full release cycle without any breaking changes
  7. Last mark 1.0.

Since changes will occur after merging this PR, to ensure the project builds and runs correctly, please review this guide.

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. Zig has the following interesting properties:

  • Manage memory manually
  • Competing with C rather than relying on it, Zig standard library does not depend on libc
  • Lightweight and simple, focus on debugging applications rather than debugging knowledge of programming languages
  • New approach to error handling, similar to well-written C error handling, but with a lot less redundancy
  • Optimized for fast compile times in debug mode and crashes with stack traces when undefined behavior occurs
  • ReleaseFast mode and ReleaseSafe mode
  • Generic data structures and functions
  • Concurrency through coroutines
  • Import .h header files and use C language types, variables and functions directly
  • Export functions, variables and types that depend on C language code, and automatically generate .h header files
  • optional type instead of null pointer
  • Cross-compilation is the main use case

073112_LnCS_2720166.png

Further reading

#Important #Zig #Milestone #Initially #Implemented #Bootstrapping #News Fast Delivery #Chinese #Open #Source #Technology #Exchange #Community

Important Zig Milestone: Initially Implemented Bootstrapping – News Fast Delivery – Chinese Open Source Technology Exchange Community

Leave a Comment

Your email address will not be published. Required fields are marked *