Thomas, Check out the smalltalk implementation in extra/smalltalk for an example of using the DSL features of Factor. Since this compiles to Factor, it also compiles to native machine code and is not interpreted like Io. A simpiler example is the RPN calculator vocab in extra/rpn.
http://docs.factorcode.org/content/vocab-smalltalk.html and http://factor-language.blogspot.com/2009/04/sup-dawg-we-heard-you-like-smalltalk-so.html http://docs.factorcode.org/content/vocab-rpn.html Also great is this blog post by Slava: http://factor-language.blogspot.com/2009/09/survey-of-domain-specific-languages-in.html -Adam On Wed, Aug 25, 2010 at 12:20 PM, Thomas Fee <[email protected]> wrote: > Very nice! I'm now torn between Io and Factor. :-) > In my mind, being able to write a DSL is very important, along with the > naturalness and power of such a DSL. > > On Wed, Aug 25, 2010 at 12:28 PM, Adam <[email protected]> wrote: >> >> There is a Factor embedding API that basically allows the VM to be >> called from C and strings to be evaluated. The only caveat is that >> the compiler must be included in the shipped image. >> >> Once you evaluate some Factor code from C you can then use the alien >> interface to interface using callbacks and the full FFI rather than >> evaluating strings: >> >> http://docs.factorcode.org/content/article-embedding.html >> http://docs.factorcode.org/content/article-alien.html >> >> -Adam >> >> On Wed, Aug 25, 2010 at 11:00 AM, Thomas Fee <[email protected]> wrote: >> > newbie question... Can Factor be used as an embedded language, e.g. for >> > game >> > development, where the main program is written in C++ for example? For >> > example, can a Factor program be compiled to C++ source, which can then >> > be >> > compiled into the game program comprised of other C++ parts? For >> > example, a >> > mouse click triggers an event callback in C++, which then invokes a >> > Factor >> > program to decide what to do (let's say that all the AI is written in >> > Factor) and then various OpenGL calls are invoked from Factor, e.g. to >> > instantiate a dialog box, or equivalently, Factor code invokes C++ >> > callback >> > that instantiates the dialog by making OpenGL calls. >> > >> > ------------------------------------------------------------------------------ >> > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >> > Be part of this innovative community and reach millions of netbook users >> > worldwide. Take advantage of special opportunities to increase revenue >> > and >> > speed time-to-market. Join now, and jumpstart your future. >> > http://p.sf.net/sfu/intel-atom-d2d >> > _______________________________________________ >> > Factor-talk mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/factor-talk >> > >> > >> >> >> ------------------------------------------------------------------------------ >> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >> Be part of this innovative community and reach millions of netbook users >> worldwide. Take advantage of special opportunities to increase revenue and >> speed time-to-market. Join now, and jumpstart your future. >> http://p.sf.net/sfu/intel-atom-d2d >> _______________________________________________ >> Factor-talk mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/factor-talk > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Factor-talk mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/factor-talk > > ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
