edited by
1,300 views
1 votes
1 votes

 For each of the following grammars, devise predictive parsers and show the parsing tables. You may left-factor and/or eliminate left-recursion from your grammars first. 

  1. $S\rightarrow 0S1\mid 01$ 
  2. $S\rightarrow +SS\mid \ast SS\mid a$ 
  3. $S\rightarrow S(S)S\mid \epsilon$ 
  4. $S\rightarrow S+S\mid SS\mid (S)\mid S\ast\mid a$ $.
  5. $S\rightarrow (L)\mid a$ and $L\rightarrow L,S\mid S$ 
  6. 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$
edited by

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
1
0 votes
0 votes
2 answers
3