741 views
1 votes
1 votes

Repeat Question $4.2.1$ for each of the following grammars and strings: 

  1. $S\rightarrow 0S1\mid 01$ with string $000111$.
  2. $S\rightarrow +SS\mid \ast SS\mid a$ with string $+\ast aaa$.
  3. $S\rightarrow S(S)S\mid \epsilon$ with string $(()())$.
  4. $S\rightarrow S+S\mid SS\mid (S)\mid S\ast\mid a$ with string $(a+a)\ast a$.
  5. $S\rightarrow (L)\mid a$ and $L\rightarrow L,S\mid S$ with string $((a,a),a,(a))$.
  6. $S\rightarrow aSbS\mid bSaS\mid\epsilon$ with string $aabbab$.
  7. The following grammar for boolean expressions:
  • $bexpr\:\rightarrow\:bexpr\:or\:bterm\mid bterm$
  • $bterm\:\rightarrow\:bterm\:and\:bfactor\mid bfactor$
  • $bfactor\:\rightarrow\:not\:bfactor\mid (bexpr)\mid true\mid false$

Please log in or register to answer this question.

Related questions

1 votes
1 votes
2 answers
3
0 votes
0 votes
0 answers
4