Various computer languages

Source: Internet
Author: User
Tags microsoft c


As a computer professional program ape, has learned a lot of languages, but never calm down to summarize a variety of languages, today in the csdn see a child shoes finishing things, feel very good, time is more urgent, first collection, after the test slowly looked.

Win9x is purely a compilation, because the code is too big, so many loopholes, stability is very poor.

NT-based WINDOWS (Win2k,xp,2003,vista), mainly written in C (a small number of hardware interaction with the code because C cannot be implemented so it is written by sinks); WINDOWS 2000 has about more than 200,000 lines of code, 80% of which are written in C;    Part of the assembly, the underlying interface is compiled with a compilation; There are also parts written in C + +.

The Linux,unix kernel is basically done with C, a small amount of code that interacts with the hardware because C cannot be implemented, so it is not used in C + + code. However, there are some advanced features of Linux that are also written in C + +. Many GNU software on the Linux,unix platform is also written in C.

As we can see from the above, the core of its operating system, whether it's windows or Linux/unix, is written in a large number of C languages and some assembly language.

  Its development vein is this: because the computer value can recognize the binary machine code, so, the beginning of the program is to use the machine code to write (punch machine is proof), very difficult. Later, using the machine code to write a program, the program can explain some of the simplest character instructions, the conversion of these character instructions to the corresponding machine code, and then executed on the computer, this is the initial version of the assembler, using these simple character instructions, greatly simplifies the writing of the Code, Instead of having to write a lot of machine code like before, you just need to find the corresponding character scripts for these machine codes, which are then translated by the assembler into a large number of machine codes. With these simple instructions, you can do a lot of things, including handling extra character instructions and converting them to machine code, so that we can use these simple character directives to write a program that handles extra-character instructions, which is translated into machine code using the initial version of the assembler, An extended version of the assembler is available, and this version of the assembler can handle more additional character instructions than the initial version of the assembler, through multiple iterations, and eventually a more complete assembler (capable of handling all assembly instructions). This is the origin of the assembler. With the assembler, we can use assembly instructions to write various assembler programs. We found that the original version of the assembler itself (which can only handle simple assembly instructions) was written using binary machine code, and most of the remainder (which could handle most of the additional assembly instructions) was written in assembly language itself. So, we see that in all the assembler world, in addition to the assembler itself is written by machine code and sink code, assembly code can also be used to implement a lot of other functions, such as many system-level tool software, including a variety of hardware dealing with the driver and so on, and a variety of compilers, For example: C language compiler. Similarly, the core of the C compiler is also written in assembly language, and can even include some machine code, but most still through the iteration to use the C language, C compiler can handle the data structure and language rules than assembly language richer, more advanced, closer to human readability, These data structures and language rules are the C language standard. In this way, there are more options, you can choose either machine code, assembly, or C language to write programs.

In this way, the use of C as the main language, plus the assembly language as a variety of low-level drivers or hardware-related parts of the code, you can write a lot of system management procedures, slowly, the integration of these programs, it is written into the core of various operating systems, including WinDOS, Linux/unix and so on. The core of WinDOS, Linux/unix and so on is written by C language and assembly language.

With the core of the operating system, we can use the existing language to develop a variety of operating system management software, which together, the formation of the operating system.

With the operating system, we can use the existing language, written in a more advanced language compiler and various SDK tools, so that we have a new high-level language, we can use this high-level language later in the code, so that the higher level to write code, will simplify a lot of the underlying details , greatly improve the efficiency, of course, or that sentence, high-level language due to the need to pass through the various compiler layer conversion processing, performance will be relatively low, but also more and more away from the bottom, lost control of the underlying, it means that if you want more detailed control is impossible, Because the intelligence you can use is a language specification that is supported by compilers in high-level languages, it is sometimes necessary, in some special cases, to use the underlying language for some special functions.

Of course, these choices have pros and cons, and you need to focus on what you want to do to choose a different language, depending on what features you need to implement. The lower the level, the same functionality, the less data structure and language rules that can be used, the greater the amount of code required, the harder it is to write, but the faster the conversion and processing is needed, and the closer the underlying hardware is, the quicker the performance Unless there is a particular emphasis on performance or the need to access the underlying (such as direct access to hardware), in most cases, the program is written in a high-level language, which is finally converted to machine code after all levels have been compiled and processed.

In this way, we can develop higher-level compilers using existing languages to support higher-level languages.

The core of the C + + compiler, for example, is developed using C, which may include some assembly code, but its complete version is still written in C + + iterative. In other words, the C + + compiler is written mainly by the C + + language, and its initial version (that is, the core) is written in C language plus some assembly language. So, with the C + + compiler, we can have more language choices.   For the C + + runtime environment, you can choose C or sink to write, but most of it is written in C + +. Of course, developing C + + compilers is like developing all compilers, and different companies can do this, producing many kinds of C + + compilers (like there are many kinds of assembler and C-language compilers), the more famous Microsoft C + +, Borland  The company's Borland C + + and so on. These C + + compilers may implement different data types and syntax for the C + + language, so later. An International Standards Agency has developed a standard for the C + + language, all compilers implement these standards, of course, in addition to implementing the C + + standard, these compilers often add their own special auxiliary functions, that is, each compiler can be used to compile the specification of the language,   In addition, these different compilers may have a variety of different features of the auxiliary features, in the compilation of code optimization, performance may be a little bit different. With these languages, we can use them to write various programs, including the Ides of these languages.

Similarly, we now have the assembly language, C language, C + + language, you can use these languages to develop a variety of other compilers, such as Sun is the beginning of the full use of C language to develop the Java compiler Javac, later, to the use of C + + development Javac Core, Plus the Java language itself to develop most of the other javac.

In fact, you can use any of the existing languages to develop a compiler for a new language (generally using an existing language, as to which language to choose, to develop a core part of the new compiler as needed, and then to develop the other major parts of the compiler in a new language with multiple iterations; You can also use the existing language to develop a new compiler), for the existing low-level language, the new language compiler for low-level language compiler, is nothing more than a program written in the low-level language. So, no matter what high-level language we see, we know that the compiler for that language is written based on an existing low-level language plus the language itself. Then, as long as the compiler for that language is installed on the operating system and the compiler for the low-level language it relies on, the new language can be used on that operating system to develop programs, including compilers for higher-level languages.

For example, the compiler for Delphi is written in C + +. The compiler for Pascal language is written in C and so on.

Language according to the way of translation, the language is divided into compiled language and interpreted language, all the scripting language (for example: Javascript,asp,php,perl, etc.) are interpreted language, it is by an interpreter (also called interpretation engine) to read a code every time, translate a sentence, execute a sentence, Repeated cycles. The compiled language is the one-time compilation of all the code into executable (EXE), how to do.


Computer can not directly understand the high-level language, can only directly understand the machine language, so the high-level language must be translated into machine language, the computer can be the value of high-level language programming program.
There are two ways of translating, one is compiling, the other is explaining. The two ways are only different in the time of translation. Compiled language written by the program before the execution, need a special compilation process, the program compiled into machine language files, such as EXE files, later to run without re-translation, directly using the results of the compilation (EXE file), because the translation is done only once, the runtime does not need to translate, Therefore, the program execution efficiency of the compiled language is high.
Interpretation is different, the interpretation of the language of the program does not need to compile, save the process, the interpretation of the language in the process of running the translation, such as the explanatory Basic language, a special interpreter can directly execute the BASIC program, each statement is executed when the translation. Such explanatory language should be translated once every time it is executed, and the efficiency is lower.
What is a scripting language?
1. Scripting languages (Javascript,vbscript, etc.) are between programming languages such as HTML and c,c++,java,c#.
HTML is commonly used for formatting and linking text. Programming languages are often used to send a series of complex instructions to the machine.
2. There are many similarities between scripting languages and programming languages, and their functions are similar to those of programming languages, and they also involve variables. The biggest difference from programming languages is that the syntax and rules of a programming language are stricter and more complex.
3. Relationship to Program code: script is also a language, which is also composed of program code.
Note: Scripting languages generally have a corresponding scripting engine to interpret execution. They usually need an interpreter to run. Javascript,asp,php,perl are scripting languages. Compiled and linked by C/C + +, you can create an EXE file that executes independently.
4. Scripting language is an explanatory language, such as Vbscript,javascript,installshield script, and so on, it is not like C + + and so can be compiled into binary code, in the form of executable files exist.
The scripting language does not need to be compiled, can be used directly, and is interpreted by the interpreter.
5. Scripting languages are generally present as text, similar to a command.
For example, if you set up a program called Aaa.exe, you can open a. aa file with an extension.
You specify a set of rules (syntax) for writing a. aa file, and when someone else has written a. aa file, your program uses this rule to understand and respond to the author's intentions. So, this set of rules is the scripting language.

Java is very special, Java programs also need to compile, but not directly compiled called machine language, but rather compiled called bytecode, and then interpreted to execute bytecode. Java can be either compiled or interpreted. With the compiler, you can translate a Java program into an intermediate code called a bytecode-platform-independent code that can be interpreted by the Java interpreter. Through the interpreter, each Java byte instruction is parsed and then run on the computer. Just compile once and the program runs to interpret the execution. Explains how it works:

You can think of Java bytecode as a machine code instruction running on a Java Virtual machine (Java VM). Each Java interpreter, whether it is a Java development tool or a Web browser that can run a Java applet, is an instance of a Java VM. JAVAVM can also be implemented by hardware.

Java bytecode makes it possible to "write once, run everywhere". Java programs can be compiled into bytecode on any platform that has a Java compiler. This bytecode can be run on any Java VM. For example, the same Java program can run on WindowsNT, Solaris, and Macintosh.

Java Platform

A platform is a hardware or software environment in which programs run. The Java platform differs from most other platforms in that it is a pure software platform that runs on other hardware-based platforms. Most other platforms are a combination of hardware and operating systems.

The Java platform consists of two parts:

    • Java Virtual machine (Java VM)
    • Java Application Interface (Java API)

We have introduced Java VMS, which are the foundation of the Java platform and can be ported to a variety of hardware-based platforms. The Java API is a collection of software components that provide a lot of useful functionality,
User interface (GUI). The Java API is grouped into libraries (packages) of related components.

Describes a Java program that runs on the Java platform, such as an application (application) or a small application (applet). , JAVAAPI and VMS separate Java programs from hardware dependencies.

As a platform-independent environment, Java is a bit slower than native code. However, clever compilers, well-modulated interpreters, and instant byte-code compilers can make Java's performance approach native code without sacrificing portability.

The following is a detailed explanation of Java as an example.

Then, on top of the OS core, use the C language to develop some operating system tools (such as many gun tools and many compilers under Linux/unix). Taking Linux/unix OS as an example, its core is written in assembly language and C, then, based on the core, using C language, developed the C + + compiler and C + + runtime environment, with the C + + compiler, you can use C + + on the operating system  Language to write some of the more advanced tool software, such as system management tools. These C + + code developed by

After the C + + compiler is compiled, running in the C + + runtime environment, you can provide system administration tools for users to use. Similarly, users can use C + + to write various kinds of software, and then run a similar compilation.

Compilers for high-level languages can be written in low-level languages. C compiler is generally written in assembly language, compiled only by machine language written

Compilers in modern computer systems are generally written in this way, assuming that we make this language L:
1) write an initial version of the compiler CL2 in a low-level language L1 for compiling a higher-level language L2. (the lowest-level language is machine code)
2) write an extended version of L2 compiler CL2 ' with the original version of the compiler CL2 supported part of the L2 language
3) Compile CL2 ' with CL2 to get an optimized version of the compiler.

4) Iterate multiple times to get a complete version of the L2 compiler.

5) Compile all L2 programs with the final version of the compiler

Explanation of the above process: the CPU of the computer can only process binary machine code, memory storage can only be binary symbols, in the beginning, people use machine code to write code (such as the original Punch machine), later, the machine code written a program, the program can read into some simple characters, And these simple characters are processed and converted into binary machine code, put into the computer to execute, this is the original assembler, it can handle (translate) the character of the command set to become assembly language; With these basic assembly character directives, you can use these instructions to simplify the writing of the Code, For example: Before doing the same processing, the machine code needs to write a lot of machine code, now if the equivalent assembly instructions to write, the values need less instruction, and these instructions after the binary assembler processing, generated an identical binary machine code.

In this way, you can use these only instructions, write some assembler, and implement some functions. Using these assembly instructions, we can write some assembly code that handles extra-character instructions, which, after processing the binary assembler, gets a new binary program that will be able to handle these extra character instructions, which is an extended assembler that uses similar iterations to gradually refine the functionality of the assembler. This is true for all compilers.

Compiler is a language translation, for high-level language, you want to let it run, you must have this language compiler or interpreter.
When assembly language is produced, the assembler (in the present view, because the assembler is one-to-one, so generally not called the compiler) is written in machine language. Then, because of the assembler, it is possible to assemble the assembly language from a compiler that writes higher-level languages.
The following compiler does the same.

Linux Kernel source code has more than 200 MB, compiled about dozens of M, and the entire windowsxp source codes have a few g, compiled about 600M.

Operating system-based software is written in the language used, that's a lot of different software may be in different languages.

Various computer languages

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.