Question: The dangling else problem of Pascal was not shared by its predecessor Algol 60. To avoid ambiguity regarding which then is matched by an else,
The dangling else problem of Pascal was not shared by its predecessor Algol 60. To avoid ambiguity regarding which then is matched by an else, Al-gol 60 prohibited if statements immediately inside a then clause. The Pascal fragment
if C1 then if C2 then S1 else S2
had to be written as either
if C1 then begin if C2 then S1 end else S2
or
if C1 then begin if C2 then S1 else S2 end
in Algol 60. Show how to write a grammar for conditional statements that enforces this rule.
Step by Step Solution
3.45 Rating (168 Votes )
There are 3 Steps involved in it
stmt con stmt non con stmt constmt ... View full answer
Get step-by-step solutions from verified subject matter experts
