Recent questions tagged parsing

1
S1)Stack contains only viable prefixes S2) handle is always on top of the stack options: a) only S1 is true b)only S2 is true c)both S1 and S2 d)neither is true
2
Consider the folllowing grammar $S\rightarrow AaS \ |\ b$ $A\rightarrow c \ |\ d \ |B$ $B\rightarrow AgC \ |\ AhC \ | \ DgC | \ DhC$ $C\rightarrow c \ |\ d \ | \ D$ $D\rightarrow eBf$ Which of the following are viable prefix ? $\left ( 1 \right )Aab$ $\left ( 2 \right )ca$ $\left ( 3 \right )cab$ $\left ( 4 \right )AgCS$
1 vote
3
Consider the Grammer S -> (S) | SS | () In the goto graph of LR(0) item, the number of inadequate states are (A). 1 (B). 2 (C). 3 (D). 4
4
Which of the following is false? The grammar $S \rightarrow a \: Sb \mid bSa \mid SS \mid \in$, where $S$ is the only non-terminal symbol and $\in$ is the null string, is ambiguous SLR is powerful than LALR An LL(1) parser is a top-down parser YACC tool is an LALR(1) parser generator
5
S-> AB / Ɛ A-> AC / 0C B->0S C->1 What is the first (A)..??
1 vote
6
Which of the following statements is false? Top-down parsers are LL parsers where first L stands for left-to-right scan and second L stands for a leftmost derivation (000)* is a regular expression that matches only strings containing an odd number of zeroes, including the empty string ... is, if L is any context-free language, then the language $L^R =\{w^R: w \varepsilon L\}$ is context-free
1 vote
7
Which one of the following is false? LALR parser is Bottom-Up parser A parsing algorithm which performs a left to right scanning and a right most deviation is RL($1$) LR parser is Bottom-Up parser In LL($1$), the $1$ indicates that there is a one symbol look-ahead
1 vote
8
Which of the following is true while converting CFG to an LL(1) grammar? Removing left recursion alone Factoring the grammar alone Removing left recursion and factoring the grammar None of the above
9
Given the following expressions of a grammar $E \rightarrow E * F / F + E / F$ $F \rightarrow F &ndash; F / id$ Which of the following is true? $*$ has the higher precedence than + - has the higher precedence than $*$ + and &ndash; have same precedence + has the higher precedence than $*$
10
Recursive descent parsing is an example of Top-down parsers Bottom-up parsers Predictive parsers None of the above
11
A top-down parser generates Rightmost Derivation Rightmost derivation in reverse Leftmost derivation Leftmost derivation in reverse
12
An ambiguous grammar is one that produces more than one left most derivation for the same sentence. more than one right most derivation for the same sentence. more than one leftmost derivation for the different sentence. i and ii i or ii ii and iii ii or iii
13
Which statement is true? LALR parser is more powerful and costly as compare to other parsers All CFG's are LP and not all grammars are uniquely defined Every SLR grammar is unambiguous but not every unambiguous grammar is SLR LR(K) is the most general back tracking shift reduce parsing method
14
Which one of the following is a top-down parser? Recursive descent parser Shift left associative parser SLR(k) parser LR(k) parser
15
Which grammar rules violate the requirement of the operator grammar? A, B, C are variables and a, b, c are terminals $A \rightarrow BC$ $A \rightarrow CcBb$ $A \rightarrow BaC$ $A \rightarrow \epsilon$ (a) 1 only (b) 1 and 2 (c) 1 and 3 (d) 1 and 4
1 vote
16
A. Ambiguous B. Unambiguous C. Complementation D. Concatenation Intersection
1 vote
17
A shift reduce parser suffers from Shift reduce conflict only Reduce reduce conflict only Both shift reduce conflict and reduce reduce conflict Shift handle and reduce handle conflicts
18
Which of the following suffices to convert an arbitrary $CFG$ to an $LL(1)$ grammar ? Removing left recursion alone Removing the grammar alone Removing left recursion and factoring the grammar None of the above
19
A grammar $G$ is $LL(1)$ if and only if the following conditions hold for two distinct productions $A \rightarrow \alpha \mid \beta$ I. First $(\alpha) \cap$ First $(\beta) \neq \left\{a\right\}$ where $a$ is some terminal symbol of the grammar. II. First $(\alpha) \cap$ ... $(\alpha) \cap$ Follow $(A) = \phi$ if $\lambda \in$ First $(\beta)$ I and II I and III II and III I, II and III
20
A-->AA+/AA*/a is it eligible to be used by SR parse. If we apply SR parse on this grammar then what will be the order of activation Record in Stack
21
X--> X(Y) / Y Y--> (X)Y / 0 / 1 / Eps
22
J -> Lx K -> Ly L -> J | K | f Whoever Answers Please Explain Methods solving such Questions .
23
24
Whether LR(1) grammar is same as that of CLR(1) grammar. If yes then please explain and if not then what is the difference between them?
25
1 vote
26
27
Which of the following productions eliminate left recursion in the productions given below: $S \rightarrow Aa \mid b$ $A \rightarrow Ac \mid Sd \mid \epsilon$ $S \rightarrow Aa \mid b, A \rightarrow bdA', A' \rightarrow A'c \mid A'ba \mid A \mid \epsilon$ ... $S \rightarrow Aa \mid b, A \rightarrow cA' \mid adA' \mid bdA', A' \rightarrow A \mid \epsilon$
Given the following statements: $S_1$: SLR uses follow information to guide reductions. In case of LR and LALR parsers, the look-aheads are associated with the items and they make use of the left context available to the parser. $S_2$: LR grammar is a large subclass of context ... not correct and $S_2$ is correct. $S_1$ is correct and $S_2$ is not correct. $S_1$ is correct and $S_2$ is correct