Yes. The reason why that's the sensible choice has to do with bounding the amount of lookahead required by the parser: when you see the first else, you don't want to have to wait until the second (or absence thereof) in order to decide which if to attach it to, so you write the syntax so that it attaches to the same if whether there's a second else or not.
if–elseambiguity, so I went away and did that.Which is that well-known right way?
Attach the
elseto the most recentifwhich doesn't already have one?else, you don't want to have to wait until the second (or absence thereof) in order to decide whichifto attach it to, so you write the syntax so that it attaches to the sameifwhether there's a secondelseor not.