Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of the compiler in the computer

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will give you a detailed explanation of the role of the compiler in the computer. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The system software that can translate the source program written in the high-level language into the target program is the "compiler". The compiler belongs to the translation program implemented by generative implementation, which takes the source program written in the high-level programming language as the input and the object program represented by the assembly language or machine language as the output.

The system software that can translate the source program written in the high-level language into the target program is the "compiler".

A Compiler,compiling program, also known as a compiler, is a translator that translates a source program written in a high-level programming language into an equivalent machine language format target program. The compiler belongs to the translator realized by the way of generative implementation. It takes the source program written by the high-level programming language as the input and the object program represented by the assembly language or machine language as the output. The compiled target program usually goes through the running phase in order to run with the support of the running program, process the initial data and calculate the required calculation results.

Features:

The compiler must analyze the source program and then synthesize it into the target program. First of all, check the correctness of the source program and decompose it into several basic components; secondly, according to these basic components to establish the corresponding equivalent part of the target program. In order to accomplish this work, the compiler needs to establish some tables in the analysis phase and transform the source program into an intermediate language form so that it can be easily referenced and processed in analysis and synthesis.

The main data structures used in data structure analysis and synthesis, including symbol tables, constant tables and intermediate language programs. The symbol table consists of identifiers used in the source program along with their attributes, which include categories (such as variables, arrays, structures, functions, procedures, etc.), types (such as integers, real types, strings, duplicates, labels, etc.), and other information needed by the target program. The constant table consists of the constants used in the source program, including the in-machine representation of the constants and the target program address assigned to them. An intermediate language program is an intermediate program introduced before translating a source program into a target program, and the choice of its representation depends on how the compiler uses and processes it later. The commonly used intermediate language forms are Polish, triple, quad, indirect triple and so on.

The analysis of some source programs is realized through three steps: lexical analysis, grammatical analysis and semantic analysis. Lexical analysis is done by a lexical analysis program (also known as a scanning program), whose task is to identify words (that is, identifiers, constants, reserved words, as well as various operators, punctuation marks, etc.), create symbol tables and constant tables, and transcode the source program into an internal form that is easy for the compiler to analyze and process. The parser is the core part of the compiler, and its main task is to check whether the source program is grammatical or not according to the syntax rules of the language. If it is not grammatical, the syntax error information is output; if grammatical, the grammatical structure of the source program is decomposed and the internal program in the intermediate language form is constructed. The purpose of grammatical analysis is to understand how words form sentences and how sentences form programs. The semantic analysis program is to further check the semantic correctness of the legal program structure, and its purpose is to ensure the correct use of identifiers and constants, collect and save the necessary information into the symbol table or intermediate language program, and carry on the corresponding semantic processing.

This is the end of this article on "what is the role of compilers in computers". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report