The Felix Programming Language

The fastest scripting language on Earth.

Download | Articles | Tools | Overview: Slideshow | Tutorial | Reference | Glossary | Community

Why do we need a new programming language?

Existing languages have too many faults to support modern requirements.



The ability to obtain high performance in a wide variety of domains is fundamental. Light-speed behaviour was a primary goal of C++ and it is for Felix too. In fact, we aim for hyper-light performance: faster than C.

Network performance matters too. This means we need platform independent asynchronous I/O. To support a large number of clients, we need lightweight threads with fast context switching.

Rapid Prototyping and scripting harness

C++ is typically very hard to build. Make files, macros, compiler and OS feature tests, switches, paths and a huge array of poorly integrated non-portable tools make development a nightmare compared with the easy of deploying Python or Perl scripts. IDEs fix these problems in a clean way, but only handle boilerplate workflows.


Unfortunately dynamic typing is not amenable to reasoning about program correctness, and traditional imperative programming also presents obstacles.

We need:

which quite a demanding list!

How Felix meets these goals.

Felix is designed to address all these issues. It is a C++ code generator and thereby can provide compatibility with existing C and C++ code bases. We let the native C++ compiler do the hard work of low level optimisation whilst Felix does high level optimisations. The resulting code is very fast, sometimes "faster than the speed of light (C)", but can be platform independent and is simply to deploy: just distribute the source files and run them, like a scripting language.

However Felix has its own type system based on a combination of Ocaml and Haskell. Like Ocaml it provides strong support for functional programming, whilst also supporting imperative programming. The type system is strict.

First order polymorphism is core, not a bolt-on as in Java and C++. Felix also provides open overloading like C++, but only allows exact matches. It also provides Haskell style type classes as an alternative way to obtain genericity.

To overcome syntactic impedence mismatching with the wide number of application domains, the Felix grammar is defined in user space. It can be extended by the end user to provide a suitable Domain Specific Sub-Language. The parser is GLR and the user actions are written in R5RS Scheme.

A rich set of shortcuts makes programming a breeze. Built-in regular expression support and other features provide string handling on par with Perl. Web programming is enabled by built-in asynchronous socket I/O combined with cooperatively multi-tasked fibres that would support millions of http clients if only the server could supply enough sockets. Context switching is achieved by a pointer swap, and state is maintained by a spaghetti stack.