[MLton-devel] Re: CPS vs SSA

Matthew Fluet fluet@CS.Cornell.EDU
Mon, 13 Jan 2003 12:19:28 -0500 (EST)


> There is something I don't understand about the SSA form
> below:
>
> > I've tweaked the CPS grammar so that it is very easy to compare with
> > the SSA grammar.  All we have to do is to replace
> >
> > <fun>      ::= fun <f> (<x>*) = <exp>
> > <exp>      ::= let <dec>* in <transfer> end
> > <dec>      ::= <bind>
> >              | <block>
> >
> > with
> >
> > <fun>      ::= fun <f> (<x>*) = let <block>* in <l> () end
> > <exp>      ::= let <bind> in <transfer> end
>
> The body of a function is <l> (). What does this mean?
> Should this have been <l> <exp>?

The <l> is the label of the starting block.  The () simply indicates that
the start label must have no parameters.  The function arguments are of
course in scope in this start block.

It is debatable whether or not the start block should have arguments, but
it really seems most reasonable to have a distinguished start block.

> Also the body of <exp> always terminates with <transfer> and
> does not allow for <simple>.

True.  To return a <simple> expression, bind the result to a variable and
leave the function via the return transfer:

<transfer> ::= <f> (<x>*)                       tail call
             | <l> (<f> (<x>*))                 nontail call
             | <l> (<x>*)                       jump
             | <x>*                             return



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel