2019.9.4 understanding of compiler theory

1) Description of the compiler and interpreter, contact the differences of the assembler.
Compiler: the source code into executable object program;
translator: translating a high-level language into another low-level language;
Assembler: Assembler language program will be translated into machine language program.

 

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

1, lexical analysis: from left to right to read the source code, to retain a variety of word sequence;

2, the syntax analysis: lexical analysis reserved word sequence broken down into various types of grammatical phrases, syntax tree can be used to represent;

3, semantic analysis: Is there a semantic error checking on the source;

4, the intermediate code generation: The source generates an internal representation form, which is easily translated target code;

5, code optimization: the generated intermediate code changes or modifications to the target code generation more efficient, save time and space;

6, object code generation: the change in the intermediate code into the instruction code executable on a machine or assembler instruction code.

 

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

Compiler is a language processing program source code to translate a high-level language into assembly language program or a binary code of the machine, the binary program can run and generate results on the machine;

Interpreter is to obtain a program and execute the program immediately, and immediately get results, then execute a program ends next sentence. Such as: pythou

 

4) understand the new open-source compiler Huawei Ark ( https://www.openarkcompiler.cn/home), understand and talk about its basic ideas and technology route, as well as its Android software ecosystem will be affected.

The basic idea: 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.

Technical Route: front-end input Java / Kotlin bytecode programs, Ark compiler intermediate representation (IR) converter converts the input into the front end of the ark IR, and fed to the rear end of the optimizer finally generate binary files, binary files and compiled run-time libraries to produce an executable file link, you can execute the file in the operating environment in the ark.

Impact: Huawei Ark compiler for open source Android mobile phone use over time it will approach Caton problems have a solution, and bid farewell to the previous situation An Zhuoka Dayton, this way the phone using software with a fast-growing Andrews.

 

Guess you like

Origin www.cnblogs.com/kmh2166/p/11458098.html