2010-02-28

goto variables

2.14: adda/translate/cstr/goto variables:
. labels targeted by {enter, exit, goto}
are constant versions of the goto variables;
ie, label.to: here
is the same as label.to`= here
except that the colon syntax gives it a value it must keep .
. a goto label is assigned the place it's declared at:
here.to: v.to`= here;
-- the variable v is assigned the constant here .
. when translating to c,
which supports only goto /constants/
-- not goto /variable/ --
the .to var must be impl'd as an enum
whose values include all of a scope's
constant .to labels,
so then a ( goto /var/ ).stmt
would be translated as casing the enum,
and mapping each enum to a constant goto label;
eg,
enum places {toplace1, toplace2, ...};
places mygoto;
mygoto = toplace1;
switch mygoto
{case toplace1: goto place1;
case toplace2: goto place2;
... } .

No comments:

Post a Comment