Grammar to consider:

Fully-bracketed syntax.

For example:

if (expr)
    statements;
    statements;
endif

if (expr)
    statements;
else
    statements;
endif

if (expr)
    statements;
elseif (expr)
    statements;
else
    statements;
endif

Or:

if (expr)

    statements;

else

    if (expr)

        statements;

    end if

end if

 

if (expr)

    statements;

else if (expr)

    statements;

end if

while (expr)
    statement;
    statement;
endwhile

do
    statements;
while (expr); <-- ambiguus with while .. endwhile

 

 

for()

endfor