Learn compiler theory

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

A: The process is to compile the source code files are processed in the form of a character stream, lexical analysis and syntax, and then by converting the assembler source code instructions into assembly instructions which the high-level language source code as input, of translation. produce object program in machine language, and then let the computer to execute the target program, the results obtained; translation program refers to the translation by the high-level language programs into machine language program; assembler is to translate assembly language programs into machine language program. Compiler to compile the code into a computer can recognize, translated into a machine language program translated by a program by the assembler.

 

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

A: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation target.

Semantic Analysis main functions: on the source scanning configuration Ken decomposed character stream, a character can be recognized.

Parsing main functions: the lexical analysis on the basis of word sequence broken down into various types of grammatical phrases.

The main function of the semantic analysis: review of the source code if there is a semantic error, generate the code for the type of information collection stage.

The main function of the intermediate code generation: generate some simple in structure and unambiguous notation system.

Code optimization main functions: conversion of the intermediate code in the transformation of the generated code is more efficient.

The main target code generation functions: the intermediate code into an instruction code on the absolute particular machine or assembly instructions may be repositionable

Code.

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

Interpreter: The simple understanding is enter a code, not by the target program, the direct output. For example Python .

Compiler : the high-level language ( such as the FORTRAN , the COBOL , Pascal , C , etc. ) source as an input, converts translation, produces an object program in machine language, and then let a computer to execute the target program, the results obtained. When you compile a program of work, the first analysis, after synthesis, thereby obtaining an object program. For example, C after the compiler .cpp file becomes .exe .

 

 

 

 

3) to 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: when the application installation is not performed AOT compilation, installation fast. When there is no first-time application of machine code, it can only be interpreted idle equipment, the system is running out to save time application code directly to code compiled into machine code (AOT).

Technology Roadmap: 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, each user will have a feeling, a very long time card, running speed super slow, and now exists to solve the plight of the Ark in Andrews appear faster and faster to solve explain the side edge operation. Ark in the event of IOS system also has the effect of flat, Huawei is more towards the further first.

Guess you like

Origin www.cnblogs.com/xuechendong/p/11465085.html