[e-lang] Expansion without HilbertHotel (was Scope oddities in ObjectExpr ...)

Kevin Reid kpreid at attglobal.net
Sat Mar 11 23:15:43 EST 2006


On Mar 11, 2006, at 21:41, Mark S. Miller wrote:
> Except for the awful Hilbert hotel renaming issue, a Kernel-E  
> expression expanded by the E-to-Kernel-E expansion should expand to  
> itself.

The ANTLR parser branch of E-on-CL, which implements Kernel-E  
expansion itself, has a name-generation mechanism which does not use  
a Hilbert hotel.

Variables generated by expansion are represented not as NounExprs but  
as 'TemporaryExpr's, which are effectively non-Selfless ENodes, so a  
fresh TemporaryExpr is not the same as any other TemporaryExpr.

After the expansions have been performed, the temporaries are  
replaced by NounExprs which are known to not exist in the tree in a  
single pass.

(defun kernelize (node)
   "Convert a general E node tree to Kernel-E."
   (reify-temporaries (e-macroexpand-all node)))

(I believe the Selfishness of the temporaries is not a problem with  
this mechanism, because it is equivalent to the Selfishness of the  
HilbertHotel.)

What do you think of this mechanism?

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list