adplus-dvertising
frame-decoration

Question

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.

a.

Only S1

b.

Only S2

c.

Both S1 and S2

d.

Neither S1 and S2

Answer: (d).Neither S1 and S2

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

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...

Similar Questions

Discover Related MCQs

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?

Q. Some code optimizations are carried out on the intermediate code because

Q. Which one of the following is FALSE?

Q. One of the purposes of using intermediate code in compilers is to

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

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

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

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.

Q. Which of the following statements is false ?

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

Q. Consider the following statements:

(I) The output of a lexical analyzer is groups of characters.
(II) Total number of tokens in printf("i=%d, &i=%x", i, &i); are 11.
(III) Symbol table can be implementation by using array and hash table but not tree.

Which of the following statement(s) is/are correct?

Q. Which one of the following statements is FALSE ?

Q. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}.

T1: a?(b∣c)*a
T2: b?(a∣c)*b
T3: c?(b∣a)*c

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 processes by the analyzer, which one of the following is the sequence of tokens it outputs?

Q. The output of a lexical analyzer is

Q. The number of tokens in the following C statement is printf("i=%d, &i=%x", i&i);

Q. Consider the following statement:

if (expression)
statement
else
statement

Which of the following describes the above statement?

Q. Removal of left recursion is necessary because?

Q. A parse tree showing attribute value at each node is called?

Q. The traversal method translation schema adapted to execute the action is

Q. The role of predictive parsing is