Question
4. Assume the following rules of associativity and precedence for expressions: Precedence Highest *, /, not +,-,&, mod - (unary) =,/=, and or, xor Lowest
4. Assume the following rules of associativity and precedence for expressions:
Precedence
Highest
*, /, not
+,-,&, mod
- (unary)
=,/=,<,<=,>=,>
and
or, xor
Lowest
Associativity Left to right
Show the order of evaluation of the following expressions by parenthesizing all sub expressions 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 * b - 1 + c
-
a * (b - 1) / c mod d
-
(a - b) / c & (d * e / a - 3)
-
-a or c = d and e
-
a > b xor c or d <= 17
-
-a + b
5. Write a BNF description of the precedence and associativity rule defined for the expressions in Problem 4. Assume the only operands are the names a, b, c, d, and e.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started