You are on page 1of 3

ASSIGNMENT #1

COMPILER CUNSTRUCTION

FAKHAR E ABID
BCSM-S17-089
Q NO 1: Importance of compiler?
Answer: A compiler is a computer program which helps you transform source code written in a
high-level language into low-level machine language. It translates the code written in one
programming language to some other language without changing the meaning of the code.
Because computer can't understand the source code directly. So, the compiler is intermediate
between human readable format and machine-readable format. The compiler will parse the
source file and translate it into machine understandable object file. In other words,
the compiler you use can impact whether you achieve optimal performance from all parts of your
systems. Compiler teaches you how real world applications are working and how to design them.
Learning Compilers gives you with both theoretical and practical knowledge that is crucial in
order to implement a programming language.

-------------------------------------------------------------------------------------------------------------------------------

Q NO 2: Relocate-able Address?
Answer: An address expression that has a fixed value, independent of run-time considerations
such as where the program is located in memory, is called an absolute address expression.
An address expression with a value that depends on run-time considerations is called a relocate-
able address expression.

-------------------------------------------------------------------------------------------------------------------------------

Q NO 3: Compiler Error types?


Answer: There are three kinds of errors: syntax errors, runtime errors, and logic errors. These
are errors where the compiler finds something wrong with your program, and you can't even try
to execute it. Syntax errors or diagnostic errors are identified by the compiler.
These errors occur when a program does not conform to the grammar of a programming
language, and the compiler cannot compile the source file.
Syntax errors are mistakes in using the language. Examples of syntax errors are missing a
comma or a quotation mark, or misspelling a word. 

A runtime error is a program error that occurs while the program is running. There are many
different types of runtime errors. One example is a logic error, which produces the wrong output.

Logic errors occur when there is a fault in the logic or structure of the problem. Logic errors do
not usually cause a program to crash. However, logic errors can cause a program to produce
unexpected results.

You might also like