in Compiler Design edited by
3,727 views
3 votes
3 votes

Given the grammar

  • $s \rightarrow T ^{\ast} S\ \mid T$
  • $T \rightarrow U+T\ \mid U$
  • $U \rightarrow a  \mid b$

Which of the following statements is wrong?

  1. Grammar is not ambiguous
  2. Priority of $+$ over $^{\ast}$ is ensured
  3. Right to left evaluation of $^{\ast}$ and $+$ happens
  4. None of these
in Compiler Design edited by
by
3.7k views

3 Answers

2 votes
2 votes
Answer: D) None of these.

a. Grammar is not ambiguous - true

b. Priority of + is > than *,  since + comes lower in parse tree - true.

c. Right associativity - true
1 vote
1 vote
Priority of + over ∗ is ensured as plus is at a lower level as compared to *  Also both are right recursive and therefore they are right-associative
0 votes
0 votes
Option D) None of these is the correct answer,

a) Grammar is not ambiguous, True

​​​​​​​b) + is having higher priority than * .

​​​​​​​​​​​​​​c) both + and * are right associative.
Answer:

Related questions