Home / Expert Answers / Computer Science / problem-1-write-a-bnf-description-of-the-precedence-and-associativity-rules-defined-below-assume-pa196

(Solved): Problem 1) Write a BNF description of the precedence and associativity rules defined below. Assume ...



Write a BNF description of the precedence and associativity rules defined below. Assume the
only operands are the names a,b,c

Problem 1)

Write a BNF description of the precedence and associativity rules defined below. Assume the only operands are the names a,b,c,d, and e. 

Precedence

Highest

*, /

 

 

+, -

 

 

- (unary)

 

Lowest

=, /= 

Associativity

Left to right

 

 

 

Problem 2)

Assume the rules of associativity and precedence for expressions described in Problem 1.

Show the order of evaluation of the following expressions by parenthesizing all subexpressions and placing a superscript on the right parenthesis to indicate order. For example, for the expression   a + b * c + d the order of evaluation would be represented as ((a + (b * c)1)2  + d)3

  1. a * b - 1 + c
  2. d * e / a - 3
  3. -a + b
Write a BNF description of the precedence and associativity rules defined below. Assume the only operands are the names a,b,c,d, and e. Precedence Highest *,/ +,- - (unary) Lowest Left to right Associativity Problem 2) Assume the rules of associativity and precedence for expressions described in Problem 1. Show the order of evaluation of the following expressions by parenthesizing all subexpressions and placing a superscript on the right parenthesis to indicate order. For example, for the expression a + b * c + d the order of evaluation would be represented as ((a + (b + c) 1)2 + d)3 a) a * b - 1 + c b) d * el a - 3 c) -a + b


We have an Answer from Expert

View Expert Answer

Expert Answer


/* If you like question ans
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe