Question

In: Computer Science

Check ambiguity, operators’ precedence and associativity ( 2) <E> → id | <E> - id |...

Check ambiguity, operators’ precedence and associativity (

2) <E> → id | <E> - id | <E> * id

Solutions

Expert Solution

A grammar is said to ambiguous if for any string generated by it, it produces more than one-

  • Parse tree
  • Or derivation tree
  • Or syntax tree
  • Or leftmost derivation
  • Or rightmost derivation

Here 3 parse tree can be generarated by the grammer

as

< E >                                 < E >                                          < E >

   |                                         |                                                  |

id                                      -id                                                *id

so the grammar is ambiguos

operator precedence

A grammar is said to be operator precedence grammar if it has two properties:

  • No R.H.S. of any production has a.
  • No two non-terminals are adjacent.

here it have no and no other non terminals

*>-

For an grammar to be associative it should be unambiguos but here the grammar is ambiguos so its not an associative grammar


Related Solutions

USING C++: Consider the precedence levels of the relational, logical, and arithmetic operators of the PySub...
USING C++: Consider the precedence levels of the relational, logical, and arithmetic operators of the PySub language to be as follows (NOTE: 5 has highest precedence and 0 lowest): 5 *, /, % 4 +, - 3 <, <=, >, >=, !=, == 2 not 1 and 0 or 1.  Infix-Postfix Conversion and Evaluation with Logical and Relational operators – Convert the following infix expression to a postfix expression and evaluate the result (assume that true=1 and false=0). Provide both the...
- What is the order of precedence between discretionary access check and Mandatory integrity check? Please...
- What is the order of precedence between discretionary access check and Mandatory integrity check? Please explain? - Suppose kkk.exe running with low integrity downloads an executable from unknownsite.com. can the download executable write to %SystemRoot%\System32? Why or Why not?
An e-retailing company assigns an ID to online orders received. Order ID starts with 3-digit number,...
An e-retailing company assigns an ID to online orders received. Order ID starts with 3-digit number, followed by four letters of alphabet. a) How many unique order IDs could be generated? b) What is the probability that first order is assigned an ID where sum of 3 digits equals 4? For instance, consider order ID “123 ABCD” with sum of three digits equals 1+2+3 = 6.
a) Check e^5x, xe^5x for independence using Wronskian
  a) Check e^5x, xe^5x for independence using Wronskian b) solve y" + 5y' + 6y = 0 c) convert the above equation to a system and solve it d) Solve x^2y''-2xy'-4y= 0 by assuming solution of the form y=x^r e) Solve the IVP using undetermined coefficients y" -2y' -3y = 6 y(0)= 3 y'(0)=11
2. (a). Prove that the sum of the two projection operators is not a projection operator,...
2. (a). Prove that the sum of the two projection operators is not a projection operator, unless the multiplication of the two projection operators produces a zero value. (b). Prove that the result of the multiplication of two projection operators is not a projection operator, unless the two projection operators are hermitian.
explain the two categories of situational moderators of gender in negotiation: 1- situational ambiguity and 2-gender...
explain the two categories of situational moderators of gender in negotiation: 1- situational ambiguity and 2-gender triggers
First prove A and B to be Hermitian Operators, and then prove (A+B)^2 to be hermitian...
First prove A and B to be Hermitian Operators, and then prove (A+B)^2 to be hermitian operators.
1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining...
1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining whether a report of an argument should be treated as an argument, it is important to consider the context in which the report is made. True True False 3) True or False: In a V argument with two premises, if one of the premises is false, then the argument is definitely weak True False 4) True or False: A report of an argument can...
Project [2]: Expressions and Operators Project Goals The goal of this project is to: 1. Get...
Project [2]: Expressions and Operators Project Goals The goal of this project is to: 1. Get students familiar with expressions and operators. Important Notes: 1. Formatting: Make sure that you follow the precise recommendations for the output content and formatting. For example, do not change the text from “You’re walking through the woods and come upon a chest. Do you open it? 1 – yes 2 - no” to “Do you open the chest? ”. Your assignment will be auto-graded...
An element e of a ring is called an idempotent if e^2 = e. Find a...
An element e of a ring is called an idempotent if e^2 = e. Find a nontrivial idempotent e in the ring Z143.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT