Lexical Analysis · Compiler Design · GATE CSE
Marks 1
Consider the following two sets:
Set X
P. Lexical Analyzer
Q. Syntax Analyzer
R. Intermediate Code Generator
S. Code Optimizer
Set Y
1. Abstract Syntax Tree
2. Token
3. Parse Tree
4. Constant Folding
Which one of the following options is the correct match from Set X to Set Y?
Group 1
P. Regular expressionQ. Pushdown automata
R. Dataflow analysis
S. Register allocation
Group 2
1. Syntax analysis2. Code generation
3. Lexical analysis
4. Code optimization
printf("i = %d, &i = %x",i, &i);
I. begin
II. program
III. <>
List - I
(a) Lexical Analysis(b) Code Optimization
(c) Code Generation
(d) Abelian Group
List - II
(p) DAG's(q) Syntax trees
(r) Push Down automata
(s) Finite automata
Marks 2
Consider the following C code segment:
a = b + c;
e = a + 1;
d = b + c;
f = d + 1;
g = e + f;
In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes of nodes in the DAG is ______
$$\eqalign{ & {T_1}:\,\,\,a?{\left( {b|c} \right)^ * }a \cr & {T_2}:\,\,\,b?{\left( {a|c} \right)^ * }b \cr & {T_3}:\,\,\,c?{\left( {b|a} \right)^ * }c \cr} $$
Note that $$'x?'$$ means $$0$$ or $$1$$ occurrence of the symbol $$x.$$ Note also that the analyzer outputs the token that matches the longest possible prefix.
If the string $$bbaacabc$$ is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
I. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation
II. Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions
III. Recursion in programming languages cannot be implemented with dynamic storage allocation
IV. Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records
V. Programming languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records