Unity University: Department of Computer Sciences
Unity University: Department of Computer Sciences
Unity University: Department of Computer Sciences
Nov, 2020
Part I
1. Compiler translate the source code to machine language
2. Compiler should report the presence of Errors in the source program, in
translation process.
3. What is the output of lexical analyzer? A set of tokens.
4. Grammar of the programming is checked at Analysis Phase of compiler.
5. Parsing Is a process of finding a parse for string of tokens.
6. Compiler can check Syntax Error errors.
7. A grammar that produces more than one parse tree for some sentence is called as
Ambiguous grammar.
8. Lexical analysis is about breaking a sequence of character into Tokens.
9. Lexeme Is considered as a sequence of characters in a token.
10. When expression result = 3+2*8 is tokenized then identify the token category of each
token in expression.
Result is “Identifier”
= is “Assignment operator”
3 is “Integer Literal”
+ is “Addition operator”
2 is “Integer Literal”
* Is “Multiplication Operator”
8 is “Integer Literal”
Part II
1. List the various phases of a compiler?
1. Lexical analysis
2. Syntax analysis
3. Semantic analysis
4. Intermediate code generation
5. Code optimizer
6. Code generation
2. What is a symbol table?
Symbol table is an important data structure created and maintained by compilers in order
to store information about the occurrence of various entities such as variable names,
function names, objects, classes, interfaces, etc. Symbol table is used by both the analysis
and the synthesis parts of a compiler.
3. Mention some of the cousins of compiler
- PreProcessor
- Assembler
- Linking and loading
4. List the phase that constitute the Front-end and back-end phase of compiler.
The front end includes all analysis phases end the intermediate code generator.
The back end includes the code optimization phase and final code generation phase.
5. List the various compiler construction tools.
1. Parser Generator
2. Scanner Generator
3. Syntax directed translation engines
4. Automatic code generators
5. Data-flow analysis engine
6. Compiler construction toolkits
Patterns- There is a set of strings in the input for which the same token is produced as output.
This set of strings is described by a rule called a pattern associated with the token
Lexeme- A sequence of characters in the source program that is matched by the pattern for a
token.
a
f
A B
d e