edited by
3,724 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
edited by

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 votes
1 votes
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

1 votes
1 votes
3 answers
1
Satbir asked Jan 13, 2020
2,254 views
A grammar is defined as$A \rightarrow BC$$B \rightarrow x \mid Bx$$C \rightarrow B \mid D$$D \rightarrow y \mid Ey$$E \rightarrow z$The non terminal alphabet of the gram...
3 votes
3 votes
4 answers
2
Satbir asked Jan 13, 2020
8,878 views
A given grammar is called ambiguous iftwo or more productions have the same non-terminal on the left hand sidea derivation tree has more than one associated sentencethere...
5 votes
5 votes
4 answers
3
Satbir asked Jan 13, 2020
3,714 views
In a two-pass assembler, resolution of subroutine calls and inclusion of labels in the symbol table is done duringsecond passfirst pass and second pass respectivelysecond...
3 votes
3 votes
3 answers
4
Satbir asked Jan 13, 2020
5,018 views
The number of tokens in the following C code segment isswitch(inputvalue) { case 1 : b =c*d; break; default : b =b++; break; }$27$$29$$26$$24$