[Aldor-l] Semicolon after single statement in if?

Ralf Hemmecke ralf at hemmecke.de
Wed May 6 19:22:59 EDT 2009


On 05/06/2009 10:47 PM, Pippijn van Steenhoven wrote:
> On Wed, May 06, 2009 at 04:11:59PM -0400, Bill Page wrote:
>> Pippijn,
>>
>> I think what you wrote should not be allowed. Since ; is used to
>> separate statements, the second line should be a syntactical error.
>> Did you get a different result when you tried this?
> 
>   #include "aldor.as"
>   #include "aldorio.as"
>   import from MachineInteger;
>   if (1 < 2) then stdout << "ok" << newline;
>   else stdout << "not ok" << newline;
> 
> The current aldor compiler will compile this fine and print "ok".

It looks strange. But I somehow think if the semi-colon is allowed that 
should be fine.

> Removing the ; from either of the two last lines will be fine. The only
> thing it does not accept is ;; anywhere.

That ;; is not accepted is somewhat strange. If I look at the grammar, 
it says:

Expression: enlist1a(Labeled, ";")

So if ever you find a place in you program where "Expression" is 
appropriate, then also ;; should be appropriate.

Ralf

PS: BTW, you don't need (..) around 1 < 2.



More information about the Aldor-l mailing list