Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The Fancy Programming Language - Fancy is a dynamic, object-oriented programming language heavily inspired by Smalltalk, Ruby and Erlang.
Fancy Ruby JavaScript Other

This branch is 1348 commits behind bakkdoor:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


The Fancy Programming Language
(C) 2010 Christopher Bertels <>


Fancy is a dynamic, object-oriented programming language heavily
inspired by Smalltalk, Ruby and Erlang. It will support dynamic code
evaluation (as in Ruby & Smalltalk), concurrency via the actor-model
and many more features yet to be implemented.


It’s still in development, the implementation has evolved from of an
interpreter written in C++ to a mostly finished bytecode compiler for the
Rubinius VM (

We're currently working on bootstrapping the language on the Rubinius VM.
If you want to help out, feel free to contact us:

For some example code (that can be successfully executed), have a look
at the examples/ directory.

There's also lots of test coverage code. Have a look at the tests/
directory for these. The tests are written in FancySpec, a simple
testing library (somewhat similar to Ruby's RSpec). FancySpec's
implementation can be viewed in lib/fancy_spec.fnc.


Compiling / Installing from source:


- Rubinius (at least 1.1)
- Rake.
- GNU Bison ( version 2.4 and higher otherwise you will get a Segmentation fault ).
- GNU Flex.

Given the tools & libraries mentioned above, Fancy _should_ build without problems
on most *nix systems. We successfully have built Fancy on Debian & Ubuntu, OpenSuSE
and Mac OS X 10.5 and 10.6.

Standard building procedure:

Building Fancy is just that easy:

  $ cd <fancy_source_path>
  $ rake

Now run the hello world example:

  $ ./bin/fancy examples/hello_world.fy

Some technical information:

As now we are running on the Rubinius VM, Fancy shares the same runtime with ruby.
Actually all of Fancy is built upon Ruby objects, so for example when you open
the String class in Fancy, it's just Ruby's String class.

Because of this, and because in Fancy's standard library (lib/*.fy) we
can define methods with the same name as they're defined in Ruby (but
taking no arguments), we have decided not to overwrite the Ruby
This way all Ruby libraries can use Ruby's Kernel#print (that takes
any number of args) and work seamlesly.

Here's an example:

    class Object {
      def print {
        "Print itself to the Console."
        Console print: self

To meet this goal, the Fancy compiler renames Fancy methods taking no
arguments (like the previous "print" example) to a method named
":print". Using explicit parens syntax will allow you to invoke any
Ruby method.

   someObject print    # Will actually invoke the Fancy ":print" method.
   someObject print()  # With explicit parens invokes the Ruby method.

Ruby method invocation supports passing a block variable to Ruby as a proc.

    class Something {
      def open: block {
        someRubyMethod(arg0, arg1, &block)
    Something new open: |s| { s work }

    # with this syntax, calling ruby's inject is just as easy.
    # This example will print the number 6
    [1, 2, 3] inject(0) |sum, num| { sum + num } println

What's already working?

  - Class definitions
    (including nested classes that work like modules / namespaces)
  - Instance & class method definitions
  - Literal syntax for:
    - String, Integer, Float, Array, Hash (HashMap), Blocks (closures),
      Ranges, Tuples, Regular Expressions
  - Method & Operator calls
  - Instance & class variable access
  - Dynamic getter and setter method definitions (similar to Ruby's attr_acessor)
  - Loops
  - Support for closures via Blocks (it works but there's definately
    room for performance improvements)
  - Local & non-local returns from Blocks & Methods
  - File reading and writing
  - Class-Mixins (including methods of one class into another)
  - Exception handling (try, catch, finally & retry)
  - Mostly all examples/*.fy files are working now under the Rubinius VM
    Please feel free to report bugs or better yet, contribute patches.
  - Simple pattern matching (work-in-progress)
  - Calling, using and extending arbitrary Ruby classes and methods
    (including C-extensions).

What's still missing?

  - Concurrency stuff (Actor-model based concurrency, Futures etc)
  - Some more advanced stuff, e.g. runtime inspection of method calls
    via MethodContext etc. (saved for later)

How is it implemented?

  - The lexer & parser are built with GNU Flex & GNU Bison.
    And used as a Ruby c-extension from rubinius.
    The parser simply invokes methods on Fancy::Parser to build the AST.
    See: rbx/parser/parser.y & rbx/parser/parser.rb

  - Once the AST is built, we use Rubinius' excellent compiler chain
    to compile it to bytecode.

  - The bin/fancy file is simply a rubinius code loader for .fy files.



Fancy is licensed under the terms of the GNU LGPL v3. For more
information on licensing issues have a look at the LICENSE file.
Something went wrong with that request. Please try again.