Question: a) Design BNF for expressions using binary + - * /, unary #, with overriding () . Use the standard writing method (binary operators are
a) Design BNF for expressions using binary + - * /, unary #, with overriding () . Use the standard writing method (binary operators are infix, unary are prefix, and standard precedence and associativity - all operators are associative) except that * has higher precedence than /, both are right to left, and + is not associative that is 1+2+3 is not valid. Expressions use identifiers or numbers.
b) Using the above, draw a parse tree for x - y * x* 3/ #x. Then give the result, using the tree, when x = 1 and y = 3, assuming the standard meaning of the operators, # is negation, and / is integer division.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
