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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!