Explain with an example how a high‒level language statement is translated step‒by‒step into assembly language and then into machine (binary) code.
Translation from High
Level Language to Machine Language
•
Computers understand only binary
instructions (0s and 1s). However, humans prefer to write programs using high‒level languages like C or Python.
Therefore, several translation steps are required before the hardware can
execute a program.
■
This is a program written in a language humans can easily understand.
■
Example (in C):
sum
= a + b;
■
Explanation:
This
statement adds two numbers, a and b and stores the result in sum.
■
The compiler translates the high‒level
language into assembly language ‒ a
low‒level, human‒readable form of machine instructions.
■
Example (Assembly code for MIPS) :
add
$t0, $t1, $t2
■
Explanation
♦ $t1 → register containing a
♦ $t2 → register containing b
♦ $t0→ register where result (sum) will be
stored
♦ add → mnemonic (symbolic name) for addition
instruction
So,
the above line meAnswer: $t0 = $t1 + $t2
■
The assembler now translates this
symbolic instruction into machine code ‒
the exact binary pattern that the hardware can execute.
■
Example (in binary) :
000000
01001 01010 01000 00000 100000
Explanation of fields (MIPS
instruction format) :

Review Question
1. Explain with an
example how a high‒level language statement is translated step‒by‒step into
assembly language and then into machine (binary) code.
Computer Organization and Architecture: Chapter 1: Introduction : Tag: Computer : - Translation from High Level Language to Machine Language
Computer Organization and Architecture
CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Discrete Mathematics
MA25C14 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation
Data Structures
CS25C08 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation
Computer Organization and Architecture
CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Object Oriented Programming
CS25C07 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Web Technologies
IT25301 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
English Communication Skills Laboratory I
EN25C03 3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation
Skill Development Course I
3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation