S → C C
C → c C | d
The grammar is
Explanation: Since there is no conflict, the grammar is LL (1) hence a predictive parse table with no conflicts can be constructed.
Which of the following statements is false?
If a grammar has more than one leftmost (or rightmost) derivation the grammar is ambiguous.
Which of the following derivations does a top-down parser use while parsing an input string?
Explanation: Left to right constructing leftmost derivation of the sentence.
Given the following expression grammar:E -> E * F | F + E | FF -> F – F | idWhich of the following is true?
Which one of the following is true at any valid state in shift-reduce parsing?
Explanation: The prefixes on the stack of a shift-reduce parser are called viable prefixes.
In the context of abstract-syntax-tree and control-flow-graph.Which one of the following is true?
Explanation: Successors depends on input .
A. Lexical analysis 1. Graph coloring
B. Parsing 2. DFA minimization
C. Register allocation 3. Post-order traversal
D. Expression evaluation 4. Production tree
A B C D
Explanation: The entire column an items matches the Column B items in a certain way.
Which of the following pairs is the most powerful?
Explanation parser algorithm is simple.
Consider the following grammar G.
S → F ⎪ H
F → p ⎪ c
H → d ⎪ c
Which one is true?
S1: All strings generated by G can be parsed with help of LL (1).
S2: All strings generated by G can be parsed with help of LR (1).
Explanation: There is ambiguity as the string can be derived in 2 possible ways.
First Leftmost Derivation
S → F
F → c
Second Leftmost Derivation
S → H
H → c
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production to parse a string with n tokens?
Explanation: the moves are n-1.