1.3. Trình thông dịch và biên dịch Mọi chương trình được viết bằng các translation - 1.3. Trình thông dịch và biên dịch Mọi chương trình được viết bằng các English how to say

1.3. Trình thông dịch và biên dịch

1.3. Trình thông dịch và biên dịch

Mọi chương trình được viết bằng các ngôn ngữ không phải là ngôn ngữ máy cuối cùng đều phải được chuyển đổi sang ngôn ngữ máy trước khi được thi hành. Chương trình ngôn ngữ cấp cao được dịch sang ngôn ngữ máy bằng một trong hai cách : bằng trình biên dịch (compiler) hoặc trình thông dịch (interpreter).

Trình biên dịch :

Sẽ chuyển đổi toàn bộ chương trình sang mã máy, rồi chứa kết quả vào dĩa để có thể thi hành về sau. Chương trình ngôn ngữ cấp cao được chuyển đổi được gọi là chương trình nguồn (source program) và chương trình ngôn ngữ máy được tạo ra được gọi là chương trình đối tượng (object program) hoặc mã đối tượng (object code). Khi người dùng muốn chạy chương trình, chương trình đối tượng sẽ được nạp lên bộ nhớ chính của CPU và các chỉ thị của chương trình sẽ được thi hành. Khi được hướng dẫn bởi các chỉ thị của chương trình, CPU sẽ truy xuất dữ liệu và tạo ra các kết quả. Trình biên dịch sẽ kiểm tra cú pháp chương trình, thực hiện các phép kiểm tra logic và đảm bảo các dữ liệu sắp được sử dụng trong các phép so sánh, tính toán đã được định nghĩa một cách hợp lý ở một nơi nào đó trong chương trình. Một chức năng quan trọng của trình biên dịch là nó sẽ tạo ra một danh sách lỗi của tất cả mệnh đề trong chương trình vi phạm cú pháp của ngôn ngữ. Danh sách này giúp lập trình viên dễ dàng sửa đổi chương trình.

Do ngôn ngữ máy phụ thuộc vào bộ vi xử lý nên các máy tính khác nhau sẽ cần có các trình biên dịch khác nhau đối với cùng một ngôn ngữ cấp cao. Ví dụ, một máy mainframe, máy mini và máy tính cá nhân cần có các trình biên dịch khác nhau để biên dịch cùng một chương trình nguồn sang mã máy của từng loại máy này.

Trình thông dịch :

Thay vì chuyển đổi toàn bộ chương trình nguồn như trình biên dịch, trình thông dịch chỉ chuyển đổi một mệnh đề của chương trình và thực hiện đoạn mã kết quả ngay, sau đó nó tiếp tục chuyển đổi mệnh đề thứ 2 rồi thi hành đoạn mã kết quả thứ 2 và cứ thế. Khi sử dụng trình thông dịch, mỗi lần chạy chương trình là mỗi lần chương trình nguồn được thông dịch sang ngôn ngữ máy. Không có chương trình đối tượng nào được tạo ra.

Các trình thông dịch thường được dùng trên các máy tính cá nhân không có đủ bộ nhớ hoặc sức mạnh tính toán cần thiết để dùng trình biên dịch. Lợi điểm của trình thông dịch là lập trình viên vẫn có thể chạy một chương trình vẫn còn lỗi cú pháp. Chỉ đến lúc thông dịch đến câu lệnh có lỗi cú pháp, quá trình thi hành chương trình mới bị ngừng lại và trình thông dịch sẽ thông báo lỗi. Ðiểm bất lợi là các chương trình thông dịch chạy không nhanh bằng các chương trình được biên dịch vì quá trình chuyển đổi sang ngôn ngữ máy được thực hiện cùng với quá trình thi hành chương trình. Vì lý do này, ngày nay, đa số các ngôn ngữ cấp cao đều dùng trình biên dịch.

1.4. Lập trình cấu trúc

Lập trình cấu trúc là một phương pháp lập trình có các đặc trưng cơ bản sau : tính đơn thể, cấu trúc điều khiển và tính vào/ra đơn. Tuân thủ theo nguyên tắc lập trình có cấu trúc sẽ giúp các chương trình dễ viết, dễ đọc, dễ hiểu, dễ kiểm lỗi và dễ hiệu chỉnh.

Tính đơn thể (modules) :

Với lập trình cấu trúc, các vấn đề trong lập trình được phân rã (chia nhỏ) thành những phần nhỏ hơn gọi là các đơn thể. Mỗi đơn thể, được gọi là một chương trình con trong các ngôn ngữ lập trình, sẽ thực hiện một nhiệm vụ định trước trong chương trình. Ðiểm lợi chính của kỹ thuật này là nó đơn giản hóa việc phát triển chương trình vì mỗi đơn thể chương trình có thể được phát triển một cách độc lập. Khi các đơn thể được lắp ghép lại, chúng tạo thành một chương trình hoàn chỉnh tạo ra được kết quả mong muốn.

Sơ đồ cấu trúc (structure chart) hay còn gọi là sơ đồ phân cấp (hierarchy chart) thường được dùng để phân rã và biểu diễn cho các đơn thể trong chương trình. Khi một quá trình phân rã chương trình hoàn tất, toàn bộ cấu trúc của chương trình sẽ được biểu diễn bằng một sơ đồ phân cấp. Sau đây là một ví dụ :

Cấu trúc điều khiển (control structure) :

Trong lập trình cấu trúc, người ta sử dụng 3 cấu trúc điều khiển để tạo nên logic của chương trình. Mọi vấn đề logic đều có thể giải quyết được bằng cách phối hợp 3 cấu trúc này. 3 cấu trúc này là : cấu trúc tuần tự (sequence), cấu trúc chọn (selection) và cấu trúc lặp (iteration).

Cấu trúc tuần tự : trong cấu trúc này, việc các quá trình được thực hiện tuần tự, từ quá trình này đến quá trình theo sau nó.

Cấu trúc chọn : hay còn gọi là cấu trúc nếu … thì …ngược lại (if….then…else) cho phép các lập trình viên diễn đạt được các logic điều kiện trong chương trình. Ý nghĩa của cấu trúc này là nếu điều kiện là đúng thì thực hiện quá trình ứng với điều kiện đúng, ngược lại, thực hiện quá trình ứng với điều kiện sai.
0/5000
From: -
To: -
Results (English) 1: [Copy]
Copied!
1.3. the process of interpreting and translation All programs are written in the language, not the language of the last machine would have to be converted into machine language before being executed. High level language program translated into machine language by one of two ways: by the compiler (compiler) or interpreter (interpreter). The compiler:Will convert the entire program into machine code, and contains results on the plate to be executed later. High level language program be converted is called the source program (source program) and machine language program was created called program object (object program) or the object code (object code). When users want to run the program, the program object will be loaded onto the main memory of the CPU and the directives of the program will be executed. When guided by the directives of the program, the CPU will retrieve the data and generate the results. The compiler will check the syntax program, performing checking logic and make sure the data going to be used in the comparison, the calculation has defined a reasonable way in somewhere in the program. An important function of the compiler is that it will create an error list of all clauses in the program violate the syntax of the language. This list helps the programmer to easily modify the program.Due to machine language depends on the processor so different computers will need to have the compiler with the same high level language. For example, a mainframe computer, mini computer and a personal computer requires the compiler to compile the same program source to the machine code of each type of this machine. Interpreter:Instead of converting the entire resource programs such as compilers, interpreters just convert a clause of the program and make the resulting code is right, then it continues to convert the second clause and then execute the script results Monday, and so on. When using the interpreter, per run the program as per the source program are translated into machine language. No program object is created.The interpreter is often used on the personal computer doesn't have enough memory or computational power needed to use the compiler. The advantage of the interpreter is the programmer can still run a program still syntax error. Just come to the interpreter the command has a syntax error, the process of implementation of the new program was stopped and the interpreter will report errors. Dew point disadvantage is the interpreter program runs not fast by the program are compiled because the conversion process to machine language is made together with the process of the implementation of the program. For this reason, today, the majority of the high level language compiler uses. 1.4. structural programming Structured programming is a programming method has the following characteristics: a single computer can, control structures and computer on/off menu. Comply with the principles of structured programming will help the program easy to write, easy to read, easy to understand, easy to check out error and easy to edit. Simple properties (modules):With structured programming, the problem in programming is the decay (split) into smaller parts called the single. Each may, is known as a subroutine in a programming language, will perform a specified task in the program. The main benefit of this technical rain as it simplifies the development of programs for every single possible program can be developed independently. When the single was, they form a complete program to produce the desired results.Diagram of the structure (structure chart) or the site map hierarchy (hierarchy chart) are often used to decay and performances to be in the program. When a decay process is complete, the whole structure of the program will be presented in a hierarchical diagram. Here is an example: Control structures (control structure):In structured programming, people using 3 control structures to make up the logic of the program. Every problem can be solved logically by coordinating this structure 3. 3 this is the structure: sequential structure (sequence), structure (selection) and the structure of the iteration (iteration). Cấu trúc tuần tự : trong cấu trúc này, việc các quá trình được thực hiện tuần tự, từ quá trình này đến quá trình theo sau nó. Cấu trúc chọn : hay còn gọi là cấu trúc nếu … thì …ngược lại (if….then…else) cho phép các lập trình viên diễn đạt được các logic điều kiện trong chương trình. Ý nghĩa của cấu trúc này là nếu điều kiện là đúng thì thực hiện quá trình ứng với điều kiện đúng, ngược lại, thực hiện quá trình ứng với điều kiện sai.
Being translated, please wait..
Results (English) 2:[Copy]
Copied!
1.3. The interpreter and compiler

All programs are written in the language is not the ultimate machine language must be converted into machine language before being executed. High-level language program is translated into machine language in one of two ways: by the compiler (compiler) or interpreter (interpreter).

Compilers:

Will convert the entire program into machine code, and then into the bowl containing the results in order to implement later. High-level language program is converted is called the source program (source program) and machine language program was created called program object (object program) or object code (object code). When users want to run the program, object program will be loaded onto the main memory of the CPU and the directives of the program will be executed. When guided by the directives of the program, the CPU will access the data and generate results. The compiler will check the syntax of the program, perform logical tests and ensure the data is going to be used in the comparison, calculations were reasonably defined in somewhere in program. Another important function of the compiler is that it will generate a list of all propositions error in the program violates the syntax of the language. This list helps programmers easily modified program.

Due to machine language depends on the processor so different computers will require different compilers for the same high-level language. For example, a mainframe, minicomputers and personal computers require different compilers to compile the same source programs into machine code for each type of machine.

Interpreter:

Instead of converting the entire program sources such as the compiler, the interpreter only convert a clause of the program and the implementation code immediate results, then it continues to convert the 2nd clause then implement the results of the 2nd code and so on. When using the interpreter, each running program is each source programs are translated into machine language. No program object is created.

The interpreter is often used on the personal computer does not have enough memory or computing power needed to use the compiler. The advantage of the interpreter that programmers can still run a program still syntax error. Only time interpreter to command syntax errors, the process of implementation of the new program is stopped and the interpreter will error. The disadvantage is that the program does not run as fast interpreter programs compiled for the transition into machine language is done with the process of implementation of the program. For this reason, today, the majority of high-level language compiler used.

1.4. Structured programming

structured programming is a programming method has the following basic characteristics: simplicity can, structural control and input / output unit. Adhere to the principle of structured programming will help the program easy to write, easy to read, easy to understand, easy to control and easy calibration error.

Simplicity can (modules):

With structured programming, problems in programmable decay (split) into smaller parts called the single can. Each unit, known as a subroutine in the programming language, will perform a predetermined task in the program. Score major advantage of this technique is that it simplifies the development of application programs for each program can be developed independently. When the unit can be assembled, they form a complete program to create the desired result.

Diagram structure (chart), also known as hierarchical diagram (hierarchy chart) is commonly used to decompose and be represented for the program menu. When a program decay process is complete, the entire structure of the program will be performed by a hierarchical diagram. Here is an example:

The structure controls (control structure):

In structured programming, it uses three control structure to create the logic of the program. All problems can be solved logically be coordinated by this structure 3. 3 structures are: Sequential structure (sequence), the structure chosen (selection) and structured loop (iteration).

Sequential structure: in this structure, the processes are performed in sequence, from the process to the process of following it.

Structure Selection: also known as the structure if ... then ... back again (if ... .then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. it uses three control structure to create the program's logic. All problems can be solved logically be coordinated by this structure 3. 3 structures are: Sequential structure (sequence), the structure chosen (selection) and structured loop (iteration). Sequential structure: in this structure, the processes are performed in sequence, from the process to the process of following it. Structure Selection: also known as the structure if ... then ... back again (if ... .then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. it uses three control structure to create the program's logic. All problems can be solved logically be coordinated by this structure 3. 3 structures are: Sequential structure (sequence), the structure chosen (selection) and structured loop (iteration). Sequential structure: in this structure, the processes are performed in sequence, from the process to the process of following it. Structure Selection: also known as the structure if ... then ... back again (if ... .then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. selected structures (selection) and structured loop (iteration). Sequential structure: in this structure, the processes are performed in sequence, from the process to the process of following it. Structure Selection: also known as the structure if ... then ... back again (if ... .then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. selected structures (selection) and structured loop (iteration). Sequential structure: in this structure, the processes are performed in sequence, from the process to the process of following it. Structure Selection: also known as the structure if ... then ... back again (if ... .then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions. then ... else) that allows programmers to express the conditions in the program logic. The significance of this structure is that if the conditions are right, the implementation process with strict conditions, in contrast, performs with the wrong conditions.
Being translated, please wait..
 
Other languages
The translation tool support: Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese, Chinese Traditional, Corsican, Croatian, Czech, Danish, Detect language, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Korean, Kurdish (Kurmanji), Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Odia (Oriya), Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Scots Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Spanish, Sundanese, Swahili, Swedish, Tajik, Tamil, Tatar, Telugu, Thai, Turkish, Turkmen, Ukrainian, Urdu, Uyghur, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu, Language translation.

Copyright ©2025 I Love Translation. All reserved.

E-mail: