Home > Common Problem > What is the system software that can translate source programs written in high-level languages ​​into target programs?

What is the system software that can translate source programs written in high-level languages ​​into target programs?

青灯夜游
Release: 2023-02-16 17:44:57
Original
27302 people have browsed it

The system software that can translate a source program written in a high-level language into a target program is a "compiler". A compiler is a translation program implemented using a generative implementation approach; it takes a source program written in a high-level programming language as input, and uses a target program expressed in assembly language or machine language as output.

What is the system software that can translate source programs written in high-level languages ​​into target programs?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

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

Compiler, compiling program, also called a compiler, refers to a translation program that translates a source program written in a high-level programming language into an equivalent target program in machine language format. . Compilers are translation programs implemented using a generative implementation approach. It takes a source program written in a high-level programming language as input, and a target program expressed in assembly language or machine language as output. The compiled target program usually also goes through a running stage 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, check the correctness of the source program and decompose it into several basic components; secondly, establish corresponding equivalent target program parts based on these basic components. In order to complete these tasks, the compiler must create some tables during the analysis phase and transform the source program into an intermediate language form so that it can be easily referenced and processed during analysis and synthesis.

The main data structures used in data structure analysis and synthesis include symbol tables, constant tables and intermediate language programs. The symbol table consists of the identifiers used in the source program together with their attributes, which include types (such as variables, arrays, structures, functions, procedures, etc.), types (such as integers, real types, strings, complex types, labels) etc.), and other information required by the target program. The constant table consists of the constants used in the source program, including the machine representation of the constants, and the target program addresses assigned to them. An intermediate language program is an intermediate form of program introduced before translating the source program into the target program. The choice of its representation depends on how the compiler will use and process it later. Commonly used intermediate language forms include Polish representation, triples, quadruples, and indirect triples.

Analysis of part of the source program is achieved through three steps: lexical analysis, syntax analysis and semantic analysis. Lexical analysis is completed by a lexical analysis program (also called a scanner), whose task is to identify words (i.e. identifiers, constants, reserved words, and various operators, punctuation marks, etc.), create symbol tables and constant tables, and convert The source program is converted into an internal form that is easy to analyze and process by the compiler. The syntax analyzer is the core part of the compiler. Its main task is to check whether the source program is grammatical according to the grammatical rules of the language. If it is not grammatical, a syntax error message will be output; if it is grammatical, the grammatical structure of the source program will be decomposed and an internal program in the form of intermediate language will be constructed. The purpose of grammatical analysis is to understand how words form sentences and how statements form programs. The semantic analysis program further checks the semantic correctness of legal program structures. Its purpose is to ensure the correct use of identifiers and constants, collect and save necessary information into symbol tables or intermediate language programs, and perform corresponding semantic processing.

Related recommendations: "Programming Learning"

The above is the detailed content of What is the system software that can translate source programs written in high-level languages ​​into target programs?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template