CD Unit 1
CD Unit 1
CD Unit 1
PART-A
1. Define Compiler (or) What does translator mean?
Compiler is a program that reads a program written in one language –the source language-
and translates it into an equivalent program in another language- the target language. In this
translation process, the complier reports to its user the presence of the errors in the
source program.
2. What is Cross complier? (Nov 21)
There may be a complier which run on one machine and produces the target code for
another machine. Such a complier is called cross complier. Thus by using cross complier
technique platform independency can be achieved.
3. Illustrate diagrammatically how a language is processed. (May 16)
4. What advantages are there to a language-processing system in which the compiler produces
assembly language rather than machine language? (Nov 20)
The compiler may produce an assembly-language program as its output, because assembly
language is easier to produce as output and is easier to debug.
5. State the two main parts of compilation and its function. (May 18) What
are the two parts of a compilation? Explain briefly. (May 16, 17)
The two parts of compilation are:
Analysis: The analysis part breaks up the source program into constituent pieces and
creates an intermediate representation of the source program. The analysis part is
called the front end of the compiler.
Synthesis: The synthesis part constructs the desired target program from the
intermediate representation. The synthesis part is called the back end of the compiler.
6. What are the phases included in front end of a compiler? What does the front end produce?
(May 22)
The analysis part is called the front end of the compiler; it includes the phases:
Lexical analysis
Syntax analysis
Semantic analysis
Intermediate code generation
The analysis part collects information about the source program and stores it in a data
structure called a symbol table, which is passed along with the intermediate representation
to the synthesis part.
9. What is Symbol Table or Write the purpose of symbol table. (May 14)
List the attributes stored in symbol table. (May 19)
Symbol table is a data structure containing a record for each identifier, with fields for the
attributes of the identifier. These attributes may provide information about the storage
allocated for a name, its type, its scope (where in the program its value may be used), and in
the case of procedure names, such things as the number and types of its arguments, the
method of passing each argument (for example, by value or by reference), and the type
returned. The data structure allows us to find the record for each identifier quickly and to
store or retrieve data from that record quickly.
The interaction is implemented by having the parser call the lexical analyzer. The call,
suggested by the getNextToken command, causes the lexical analyzer to read characters
from its input until it can identify the next lexeme and produce for it the next token,
which it returns to the parser.
PART – B
1. Describe the various phases of a compiler and tract it with the program segment (position=initial + rate *
60)(May 16, May 19, Nov 21, May 22)