
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Using quadruples for encoding elementary operations, determine how the fol- lowing expression will be evaluated:
a · (b − c/d/e + f · g)/h − i Starting point: you can encode c/d as (/, c, d, t 1 ), which signifies that c/d = t 1.
Dijkstra’s two-stack algorithm for evaluating expressions uses, as the name sug- gests, two stacks: an operand stack (values) and an operator stack. Using the algorithm, evaluate the following expressions:
a/b · c − d · e + f
a · (b − c/d · e) + (f − g · h)/i
In prefix form, the operator precedes the operands; so, for example, instead of writing in infix form a + b, the prefix notation will be +ab. Similarly, for b · (c − d), the prefix notation will be ·b − cd. Generate the prefix notation for the following expression:
a · (b − c/d · e)/f − g · h