ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Can be run directly from the code
|
|
Need to be translated before execution
|
|
Are targeted at a specific CPU
|
|
None of the above
|
Detailed explanation-1: -High-level language programs must be translated into machine language before they can be executed. (Machine language instructions are encoded as binary numbers that are meant to be used by a machine, not read or written by people. High-level languages use a syntax that is closer to human language.)
Detailed explanation-2: -Loosely-speaking, computers can only execute programs written in low-level languages. Thus, programs written in a high-level language have to be translated before they can run. This translation takes some time, which is a small disadvantage of high-level languages.
Detailed explanation-3: -The high-level language is easier to understand for the users but the computer can not understand it. High-level language needs to be converted into the low-level language to make it understandable by the computer. We use Compiler or interpreter to convert high-level language to low-level language.
Detailed explanation-4: -High-level language programs must also be translated to machine language before they can be executed. The translator programs that do this are called compilers (Figure 9-4). Compilers for a particular high-level language can be produced for various computers with different machine languages.
Detailed explanation-5: -However, computers cannot understand source code. Before it can be run, source code must first be translated into a form which a computer understands. A translator is a program that converts source code into machine code.