What is the source code of go language written in?

青灯夜游
Release: 2022-12-27 16:49:18
Original
5075 people have browsed it

The early source code of Go language was written in C language and assembly language. From Go 1.5 version onwards, it is completely written in Go language itself. As early as early 2014, Google had begun preparations to completely remove the C language from the source code of the Go language, which meant that the Go language could truly complete bootstrapping and rewrite the Go language compiler with an earlier version.

What is the source code of go language written in?

The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.

The Go language has now implemented bootstrapping, which means that Golang is now written in Golang itself. In the early days, Go was implemented in assembly language and C language. Later, when Go matured, the Go language began to bootstrap and rewrite the Go language compiler with an early version.

From Go 1.5 version onwards, it is completely written in Go language itself. The source code of Go language is of great reference significance for understanding the underlying scheduling of Go language. Readers who want to have an in-depth understanding of Go language are recommended to read it.

Project link: https://github.com/docker/docker

##Google gradually implements the "de-C language" of Go language

The core of many programming languages ​​is the C language. It can even be said that the core foundation of modern computers is built on the C language and Unix. Ken Thompson and Dennis Ritchie created the C language and Unix, then C and Unix regenerate everything. JVM, PHP core, GCC, Emacs, Vim, Unix, Linux, etc., are all written in C language.

The Go language is naturally no exception. The Go language compiler was originally written in C language. One of the authors of the Go language is the famous founder Ken Thompson. As early as early 2014, Google had already begun preparations to completely remove the C language from the source code of the Go language, which means that the Go language can truly complete bootstrapping.

What is the source code of go language written in?

Google’s specific plan to bootstrap Go language

Go language is a very efficient programming language , has better performance and higher resource usage efficiency than Java, C#, PHP, Python and other virtual machine-based and interpreted languages. Basically, apart from C/C, the Go language is the high-level language with the best performance. Compared with C and C, the Go language has great advantages in syntax.

Both Java and PHP can only be partially bootstrapped. Java's JVM must still be implemented in C language, and the core of PHP must also be written in C language. The programming language that can implement bootstrapping must be Turing complete. Therefore, HTML and CSS cannot be bootstrapped, and they are not programming languages ​​in the true sense.

Google’s specific implementation steps: develop a C to Go compiler, translate the existing C compiler into Go language; convert the compiler source code tree to obtain a Go language compiler; make the C style obvious The Go compiler is transformed into a thorough Go language-style Go compiler; the Go compiler is optimized, mainly optimizing processor and memory performance usage issues, adding parallel mechanisms, optimizing and eliminating redundant checks and boundary checking capabilities; using the latest version go/parser and go/types replacement compiler front ends.

What is the source code of go language written in?

Why does Google want the Go language to implement bootstrapping?

The significance of bootstrapping has three main points: testing the bootstrapped programming language; implementing a higher-level and abstract programming language to write a compiler; the programming language can also develop from the language itself Benefit.

Being able to bootstrap prove that at least the programming language is Turing complete, which proves that the programming language itself has such a powerful ability. This itself is also a kind of publicity for the programming language. At least it proves that the programming language is very versatile. Ability, and very strong underlying capabilities. The bootstrapping process is essentially a test of the programming language. In this process, the core developers can accumulate a lot of experience and lessons of the programming language itself, and can discover the shortcomings and design flaws of the programming language itself as early as possible, so as to facilitate timely development. Make adjustments and optimizations.

Therefore, if a programming language wants to bootstrap, the sooner it is done, the better. The bootstrapping process is also a process of improving the programming language. The sooner the bootstrapping is completed before the programming language is finalized, the better. The sooner you mature, the reason why C/C has endured for so many years is because they are mature enough. The development of other programming languages ​​depends on these two programming languages. The Go language now also has this possibility.

Go language is an excellent programming language with modern design concepts, strong capabilities, and good performance. Although Go language lacks macros and generics, which will make your code highly repetitive, Go language has more It is a relatively young programming language developed by abandoning the shortcomings of C/C and absorbing the advantages of many programming languages. A large number of engineering practices in the Go language have proven that it is an extremely powerful programming language.

【Related recommendations: Go video tutorial, Programming teaching

The above is the detailed content of What is the source code of go language written in?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template