grammarware / software-evolution

Software Evolution
MIT License
1 stars 0 forks source link

dangling END of IF parsing #10

Open MrDurion opened 6 months ago

MrDurion commented 6 months ago

Suppose we have the following sentence: IF BOOLEXPR1 THEN DISPLAY A IF BOOLEXPR2 THEN DISPLAY B END DISPLAY C. Then the END can be part of either the outer IF, or the inner IF. What is the correct way to interpret the END here? Is the END keyword meant to end the innermost IF statement, like a break in loops for other languages, or is it an ambiguous thing and should we provide an error like the dangling-ELSE?

grammarware commented 6 months ago

The END in your example is as ambiguous as the dangling ELSE, so it should produce an error. However, if the DISPLAY C part is removed, then it becomes easy to interpet it one way, which is more thanks to the . than to the END