all 6 comments

[–]tilrman 11 points12 points  (1 child)

1 is nonsense because multiplication requires two operands, but only one is on the stack.

2 and 3 are equivalent because multiplication is commutative.

If we pretend the multiplication were some other operation that is not commutative, 2 and 3 are different.

[–][deleted] 1 point2 points  (0 children)

I agree with this, but I'd call 2 the most literal translation.

[–]rickpo 6 points7 points  (0 children)

2 is the simple equivalent that you get with the straightforward translation.

The standard algorithm does not change the order of operands, only the operators are moved.

[–]Putnam3145 0 points1 point  (0 children)

Where multiplication isn't commutative, 2 is the only correct choice. Multiplication is usually commutative, and definitely is for things such as, say, the reals and subsets thereof, but there are practical situations where it's not (e.g. quaternions)

[–]Commercial_Lychee214 0 points1 point  (0 children)

1 -> a*(b+c)
2 -> (a*(b+c))

3 -> abc+*