The first job - understanding of compiler theory 1

1) Description of the compiler and interpreter, contact the differences of the assembler.

  Compiler - a program sequence is running a full compilation of the first; is an interpreter and a translator translate and execute the program.

Source code by the C compiler, an assembler source, and then generate the target program by the assembler, and finally generate executable by the linker.

Translation program - refer to translate high-level language source code into machine language source code (object code) software. Translation program, there are two: one is the compiler, it will be high-level language source programs all at once translated into the target program, each time the execution of the program, as long as the target program. Another is to explain the program, its execution is a translation of an execution, and do not generate the target program.

Assembler - also a language translation program that translates assembly language source code into machine language program.
If the source language is a "high-level language", and the target language such as assembly language or machine language like "low-level language," such a translation program called a compiler.
If the source language is assembly language and the target language is the machine language, such a translation program called assembler.

 

2) compilation process, including the main function of which several main stages and each stage.

  Compilation process is generally divided into lexical analysis, syntax analysis, semantic analysis and code generation, code optimization and code generation targets six main stages. The main function of the various stages are as follows:

Lexical analysis - a left to right character by character read source program, the source of the character stream constituting the scanning and decomposed to identify.

Parsing - on the basis of the sequence of words in lexical analysis broken down into various types of grammatical phrases.

Semantic Analysis - review whether the source semantic errors, code generation phase information collection types.

Intermediate code generation - After work syntax analysis and semantic analysis phase, some compiler source program into an internal representation.

Generating object code - the intermediate code into an instruction code on the absolute or specific machine instructions relocatable instruction code or assembler code.

 

3) Description of the difference between the interpreter and compiler.

The compiler can generate the target program, but the program can not interpret. Compiler to compile the overall finished, and then a one-time execution. The compiler is the source of each statement are compiled into machine language , and save it as a binary file, the computer can directly in machine language to run this program is running so fast.

The interpreter is he explains, while execution.  Submit an explanation after the implementation of a computer, do not form the target program. Like foreign language translation of the "interpretation", as a turn to say, do not produce the full text of the translated text. Interpreter is only in the implementation of the program, only one by one into machine language to explain the computer to perform, so speed is not as good as the program compiled to run fast. This is because the computer can not directly recognize and enforce our written statement, it can only know the machine language.

 

4) understand the new open-source compiler Huawei's Ark, understand and talk about its basic ideas and technology route, as well as its Android software ecosystem will be affected.

Ark compiler is designed to support multiple programming languages, jointly compiled a variety of chip platforms, designed to run unified programming platform, including compilers, tools, chain, and other key components of the runtime.  Ark compiler also continue to evolve, the ability to continue to achieve the above and open source.

Hardware trends - smart times, all things Internet, terminal equipment complex and diverse, and gradually form a mobile phone-centric, multi-device interoperability trends.

Software ecological development demands - a variety of terminal equipment, application scenario after another, programming languages, diverse operating environment, the efficiency of interoperability between different programming languages continue to affect application performance, device platform differences inconvenience to developers.

Ark compiler bring solutions - through a unified multi-language IR representation can be achieved in a variety of application programming language compiler optimization to enhance the joint performance; at the same time, multi-platform support, providing easy development and deployment strategy to enhance the efficiency of the device according to feature .

The basic idea: The installation fast, initial use the application when there is no machine code, and therefore can only be interpreted when the device is idle execution, the system saved time is running out application code directly to code compiled into machine code. Ark compiler to optimize the code, the program brings higher performance.

Technology Roadmap: Support multi-language co-optimizing compiler, through a unified representation and optimization procedures to perform more efficiently. A considerable part of the code requires temporary synchronization compiled by the virtual machine on the phone when the program is running, affect the efficiency of program execution. Huawei's Ark static compiler compiler has taken the way, it is the first to replace the static compiler Android virtual machine model.

Impact: Before we used the Android operating system, with a long time is very card, and after a long memory with fewer speed faster and faster, the speed will be up and running with more and after a long time, now appears to solve the ark in Andrews difficulties exist, faster and faster, improving the efficiency of application execution, the ark appears to IOS system also has the effect of flat, Huawei to further move towards more, it is to make users have a better experience.

Guess you like

Origin www.cnblogs.com/pangminhua/p/11468890.html