On Wed, Aug 26, 2009 at 8:26 AM, Tom Schouten<[email protected]> wrote: > But, you're making me curious. > Is it possible to macro-translate Scheme into Factor? > > I assume the answer is yes as I think Factor has compatible lexical > scoping and tall calls.. So, did anyone do it already?
While it is true that many Scheme features have Factor equivalents -- lexical closures, mutable locals, tail calls -- some don't have a direct equivalent, for example nested procedures, or procedures defined in non-null lexical environments (for example, a let at the top level with a define inside). However it shouldn't be too hard to write a transformation pass which can convert such code into using only top-level Factor word definitions; Scheme to C compilers use similar techniques. Also &rest parameters might be a challenge to map efficiently to Factor, since you'd want to avoid constructing the parameter list in as many cases as possible. But again, there are existing techniques for this. A complete Scheme compiler that can target Factor would be less effort than generating straight C, since all the necessary data types and memory management is provided by Factor, but it would still involve a bit of work to map Scheme's evaluation semantics to efficient code. This would be a good first Factor project for someone who is already familiar with how Scheme systems are implemented... Slava ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
