descriptionFunky embeddable interpreter and programming language
homepage URLhttp://funky.sourceforge.net/
ownerronald@landheer-cieslak.com
last changeMon, 12 Jan 2009 18:16:18 +0000 (12 13:16 -0500)
content tags
add:
readme

Welcome to the Funky embeddable interpreter and programming language

As the documentation will tell you, Funky is a tiny, easily embeddable functional programming language, written in C++. As the language and the interpreter are both pretty small, there is nothing much to tell about them, except perhaps the "when", "why", "what" and "how" of its history, so here goes..

When was Funky created?

The very first version of Funky was created during my daughter's nap on a snowy sunday afternoon. It was slightly refined one evening while my daughter and my wife were both sleeping and I was rocking the baby's "cozy" with my foot (as I am doing now). The initial programming therefore took about 90 minutes, whereas a bit of fine-tuning and turning the original parser/interpreter into a parser/interpreter with two phases (parsing and interpreting) took another two hours or so.

Why was Funky created?

The original idea wasn't mine: at work, a colleague needed a functional, embeddable programming language and created one from scratch. It took him a few days to do so, but he wrote the parser and the scanner by hand. I heard about his little language and thought it might be a nice idea to have one of those in the free world.

Also, as a personal challenge, I decided I should be able to write one of those in much less time that a few days, but using the right tools. Hence, one sunday afternoon I took my laptop computer and started typing. I decided to use Boost.Spirit to write the parser: I had already read the documentation once while doing some research for the Jail programming language and found it a pretty good framework to build a parser one. 90 minutes later, I had the first working version of a Funky interpreter (but it wasn't embeddable yet and didn't split the parsing and interpreting phases).

So, what exactly is Funky?

As stated, Funky is a tiny, embeddable programming language with almost unlimited extending capabilities. It presents itself as a single class which contains the entire interpreter. Two versions of this class exist: Funky::Funky, which is a floating-point version, and Funky::Groovy, which is an integer version. You can install your own functions in the language as long as your functions take a vector of the built-in type of the interpreter as return an instance of that built-in type (or a vector of those).

Funky is a functional programming language. As such, it treats everything as functions and those functions handle only one type: double in the case of Funky::Funky or int in the case of Funky::Groovy.

The documentation provided on this site is far more exhaustive than I care to be on this page, so for more details I'll refer you there..

How does Funky work?

The current version of Funky works in two phases: it first creates an abstract syntax tree by parsing the input you pass to it. It then prunes the tree of anything that is can see as a function, and stores those functions in an internal map, with the function pointers you may already have given it. As every function can only have one definition, the script's definitions of any functions you may have put in the interpreter will override anything you have given it at that point - but you can install functions after the parsing phase.

Once it starts evaluating the parsed script, it creates an evaluator and passes the parsed "main" function to it - the main function is the function without an explicit name that comes at the end of the script. The evaluator traverses the AST, calls any functions that need calling and will finally return with a value, which will be the return value of the script.

Hence, running a script goes through two distinct phases: parsing and evaluating, which allows you to determine which functions can be overridden by user scripts (the ones you install before parsing) and which can't (the ones you install after parsing).

How can I use Funky?

For your convenience, the source distribution contains a "solution" file for Microsoft Visual Studio 2005 as well as a GNU autoconf-generated configury. The GNU "project" files do not use GNU automake, but do use GNU libtool and have been tested on Debian GNU/Linux Stable and on Cygwinhttp://cygwin.com

In order to compile Funky, you need to have a version of Boost that includes Boost.Spirit installed somewhere where your compiler can find it. You also need Loki by Andrei Alexandrescu for its ScopeGuard.

As far as I know, I cannot legaly distribute the DLL compiled with Visual Studio so, for the time being, you will have to compile it yourself. If there is any demand for it, I will create a C API for Funky and distribute a DLL compiled with MinGW.

Should there be any demand for them, I'll be happy to create Debian and/or Cygwin packaged of Funky as well.

shortlog
2009-01-12 Ronald Landheer... Add Lazy, a lazy-evaluating version of Groovymaster
2009-01-07 Ronald Landheer... SVG version of the logo wasn't in Git yet
2008-03-04 Ronald Landheer... Add 1000 interpretations to measure the overhead of...
2008-03-04 Ronald Landheer... Add the possibility to pass user-defined data to instal...
2008-03-04 Ronald Landheer... Add gitignore file
2007-07-30 Ronald Landheer... Several documentation updates
2007-07-24 Ronald Landheer... Merge with /scm/git/Funky.git
2007-07-24 Live session... Fixed compile error on G++ 4.1
2007-07-22 Ronald Landheer... Micro-correction to FAQ
2007-07-22 Ronald Landheer... Last change to doxygen doxyfile for version 1.2.00
2007-07-22 Ronald Landheer... Committing configury for version 1.2.00
2007-07-21 lanrona001Documentation change for version 1.2.00
2007-07-21 lanrona001Documentation updates for version 1.2.00
2007-07-21 lanrona001Adding all the files for an integer version of Funky...
2007-07-21 lanrona001(no commit message)
2007-04-07 lanrona001Add and change documenttion
...
heads
15 years ago master