[Aldor-l] Semicolon after single statement in if?
David Casperson
casper at unbc.ca
Wed May 6 18:24:28 EDT 2009
hi folks,
I don't have definite proof that it is legal, but I seem to remember that
x:=3 ; ++ post
++ document
is a legal expression, and consequently could be substituted for Y in
if Z then Y else other ;
If that is the case
x:=3 ;
may reduce to an expression (that is followed by a list of zero
post-documents).
Does this help?
David
--
David Casperson,
UNBC
-------------- next part --------------
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".
Removing the ; from either of the two last lines will be fine. The only
thing it does not accept is ;; anywhere. The point why I am asking this
is that in libaldor (I think, or maybe it was libalgebra), there are
several places where "if (a) then b; else c;" occurs and I don't think
this is actually valid.
--
Pippijn van Steenhoven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://mail.aldor.org/pipermail/aldor-l_aldor.org/attachments/20090506/2e81f498/attachment-0002.bin>
-------------- next part --------------
_______________________________________________
Aldor-l mailing list
Aldor-l at aldor.org
http://aldor.org/mailman/listinfo/aldor-l_aldor.org
More information about the Aldor-l
mailing list