Question
S → C C
C → c C | d
The grammar is
a.
LL(1)
b.
SLR(1) but not LL(1)
c.
LALR(1) but not SLR(1)
d.
LR(1) but not LALR(1)
Posted under GATE cse question paper Compiler Design
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Consider the grammar shown below. S → C C C → c C | d The grammar is
Similar Questions
Discover Related MCQs
Q. Consider the translation scheme shown below
S → T R
R → + T {print ('+');} R | ε
T → num {print (num.val);}
Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string '9 + 5 + 2', this translation scheme will print
View solution
Q. Consider the syntax directed definition shown below.
S → id : = E {gen (id.place = E.place;);}
E → E1 + E2 {t = newtemp ( ); gen (t = El.place + E2.place;); E.place = t}
E → id {E.place = id.place;}
Here, gen is a function that generates the output code, and newtemp is a function that returns the name of a new temporary variable on every call. Assume that ti's are the temporary variable names generated by newtemp. For the statement 'X: = Y + Z', the 3-address code sequence generated by this definition is
View solution
Q. Which of the following statements is false?
View solution
Q. Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order.
View solution
Q. Given the following expression grammar:
E -> E * F | F + E | F
F -> F - F | id
which of the following is true?
View solution
Q. Which one of the following is True at any valid state in shift-reduce parsing?
View solution
Q. In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is True?
View solution
Q. Match the following:
List-I List-II
A. Lexical analysis 1. Graph coloring
B. Parsing 2. DFA minimization
C. Register allocation 3. Post-order traversal
D. Expression evaluation 4. Production tree
Codes:
A B C D
(a) 2 3 1 4
(b) 2 1 4 3
(c) 2 4 1 3
(d) 2 3 4 1
View solution
Q. Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?
View solution
Q. Consider the following grammar G.
S → F ⎪ H
F → p ⎪ c
H → d ⎪ c
Where S, F and H are non-terminal symbols, p, d and c are terminal symbols. Which of the following statement(s) is/are correct?
S1: LL(1) can parse all strings that are generated using grammar G.
S2: LR(1) can parse all strings that are generated using grammar G.
View solution
Q. A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
For the correct answer in Q75, how many steps are required to derive the string and how many parse trees are there?
View solution
Q. Some code optimizations are carried out on the intermediate code because
View solution
Q. Which one of the following is FALSE?
View solution
Q. One of the purposes of using intermediate code in compilers is to
View solution
Q. Consider the grammar rule E → E1 - E2 for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If E1 and E2 do not have any common sub expression, in order to get the shortest possible code
View solution
Q. Consider the intermediate code given below:
1. i = 1
2. j = 1
3. t1 = 5 * i
4. t2 = t1 + j
5. t3 = 4 * t2
6. t4 = t3
7. a[t4] = –1
8. j = j + 1
9. if j <= 5 goto(3)
10. i = i + 1
11. if i < 5 goto(2)
The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, are
View solution
Q. Consider the following code segment.
x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;
The minimum number of total variables required to convert the above code segment to static single assignment form is
View solution
Q. Which of the following derivations does a top-down parser use while parsing an input string?
The input is assumed to be scanned in left to right order.
View solution
Q. Which of the following statements is false ?
View solution
Q. Consider a program P that consists of two source modules M1 and M2 contained in two different files. If M1 contains a reference to a function defined in M2, the reference will be resolved at
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Compiler Design? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!