Abdullahi Umar CSC 316 Assignment.
Abdullahi Umar CSC 316 Assignment.
FACULTY OF COMPUTING.
ASSIGNMENT.
CSC 316
COMPILER CONSTRUCTION.
24-07-2024
BY
Abdullahi Umar
WITH
REGISTRATION NUMBER:
MIUSTD2021252
QUESTION:
Q1- Explain the differences between Assembly Language, machine language And high level language.
Q1-ANSWER:
Machine Language:
1. Low-Level Representation: Machine language is the lowest level of programming language. It consists of
binary instructions (0s and 1s) that directly correspond to the instructions executed by the computer's
central processing unit (CPU).
2. Hardware-Specific: Each computer architecture has its own unique machine language. Programs written
in machine language are specific to a particular CPU and cannot be easily ported to other architectures.
3. Difficult for Humans: Writing programs in machine language is extremely challenging for humans due to
its cryptic nature. Instructions are represented as raw binary codes, making it error-prone and tedious.
I.
4. Direct Execution: Machine language instructions are executed directly by the CPU without any
translation. This makes it the fastest way to interact with hardware.
5. Examples: Machine language instructions might include loading data from memory, performing
arithmetic operations, or branching based on conditions.
Assembly Language:
2. One-to-One Mapping: Each assembly language instruction corresponds directly to a machine language
instruction. Assembler programs convert assembly code into machine code.
4. Close to Hardware: Assembly language allows programmers to access hardware resources directly,
making it useful for tasks like device drivers and embedded systems.
5. Examples: An assembly program might load data from memory, add two numbers, and store the result
back in memory.
High-Level Language:
1. Abstraction: High-level languages (e.g., Python, Java, C++) provide a high level of abstraction.
Programmers write code using human-readable syntax and meaningful keywords.
3. Productivity: High-level languages simplify programming tasks. They offer built-in functions, libraries,
and data structures, reducing the amount of code needed.
4. Readable and Maintainable: High-level code is easier to read, understand, and maintain. It encourages
good programming practices.
5. Examples: Writing a web application in Python, creating a game in Unity (C#), or developing Android
apps using Java.
Q2-ANSWER:
Machine Language
2
Advantages are:
Disadvantages are:
Assembly Language
Advantages are :
High Level of Control, Access to Registers and Memory, No Compiler Dependency, Easier Bug
Identification.
Disadvantages are :
High-Level Language
- Advantages are :
- Disadvantages are: