search
Log In
0 votes
16 views

Consider the context-free grammar

$S\rightarrow SS+\mid SS^{\ast}\mid a$

  1. Show how the string $aa+a^{\ast}$ can be generated by this grammar.
  2. Construct a parse tree for this string.
  3. What language does this grammar generate? Justify your answer.
in Compiler Design
edited by
16 views

Please log in or register to answer this question.

Related questions

0 votes
0 answers
1
69 views
Construct unambiguous context-free grammars for each of the following languages. In each case show that your grammar is correct. Arithmetic expressions in postfix notation. Left-associative lists of identifiers separated by commas. Right-associative lists of identifiers separated by commas. Arithmetic ... binary operators $+, -, *, /$. Add unary plus and minus to the arithmetic operators of $(d)$.
asked Jul 26, 2019 in Compiler Design Lakshman Patel RJIT 69 views
1 vote
2 answers
2
209 views
Which of the grammars are ambiguous? $S\rightarrow 0S1 \mid 01$ $S\rightarrow +SS \mid -SS \mid a$ $S\rightarrow S(S)S \mid \epsilon$ $S\rightarrow aSbS \mid bSaS \mid \epsilon$ $S\rightarrow a \mid S+S \mid SS \mid S^{\ast} \mid (S)$
asked Jul 26, 2019 in Compiler Design Lakshman Patel RJIT 209 views
0 votes
0 answers
3
52 views
What language is generated by the following grammars? In each case justify your answer. $S\rightarrow 0S1 \mid 01$ $S\rightarrow +SS \mid -SS \mid a$ $S\rightarrow S(S)S \mid \epsilon$ $S\rightarrow aSbS \mid bSaS \mid \epsilon$ $S\rightarrow a \mid S+S \mid SS \mid S^{\ast} \mid (S)$
asked Jul 26, 2019 in Compiler Design Lakshman Patel RJIT 52 views
0 votes
1 answer
4
400 views
Consider the context-free grammar:$S\rightarrow SS + \mid SS {\ast} \mid a$and the string $aa + a{\ast}$. Give a leftmost derivation for the string. Give a rightmost derivation for the string. Give a parse tree for the string. Is the grammar ambiguous or unambiguous? Justify your answer. Describe the language generated by this grammar.
asked Aug 7, 2019 in Compiler Design Lakshman Patel RJIT 400 views
...