# Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 1 (Page No. 257 - 258)

1 vote
144 views

Describe all the viable prefixes for the following grammars:

1. The grammar $S\rightarrow 0S1\mid 01$ of Question $4.2.2(a)$.
2. The grammar $S\rightarrow SS+\mid SS\ast\mid a$ of Question $4.2.1$.
3. The grammar $S\rightarrow S(S)\mid \epsilon$ of Question $4.2.2(c)$.

## Related questions

1
81 views
Consider the family of grammars $G_{n}$, defined by: $S\rightarrow A_{i}b_{i}$ for $1\leq i\leq n$ $A_{i} \rightarrow a_{j} A_{i}\mid a_{j}$ for $1\leq i,j\leq n$ and $i\neq j$ Show that: $G_{n}$, has $2n^{2}-n$ productions. $G_{n}$, has $2^{n} + n^{2} + n$ sets of $LR(0)$ items. $G_{n}$ is $SLR(1)$. What does this analysis say about how large $LR$ parsers can get?
Show that the following grammar: $S\rightarrow SA\mid A$ $A\rightarrow a$ is SLR(1) but not LL(1).
Show that the following grammar: $S\rightarrow AaAb\mid BbBa$ $A\rightarrow \epsilon$ $A\rightarrow\epsilon$ is LL(1) but not SLR(1).
Modify the SDD of Fig. $5.25$ to include a synthesized attribute $B.le$, the length of a box. The length of the concatenation of two boxes is the sum of the lengths of each. Then add your new rules to the proper positions in the SDT of Fig. $5.26$.