Felix is an advanced Algol like procedural programming language with a strong functional subsystem. It features ML style static typing, first class functions, pattern matching, garabge collection, polymorphism, and has built in support for high performance microthreading, regular expressions and context free parsing.
The system provides a scripting harness so the language can be used like other scripting languages such as Python and Perl, but underneath it generates native code to obtain high performance.
A key feature of the system is that it uses the C/C++ object model, and provides an advanced binding sublanguage to support integration with C/C++ at both the source and object levels, both for embedding C/C++ data types and functions into Felix, and for embedding Felix into existing C++ architectures.
The Felix compiler is written in Objective Caml, and generates ISO C++, which should compile on any platform.
Latest News
Announcing FBuild 0.1
posted on June 27, 2009 - 11:57 PM PDT
by Erick Tryzelaar
filed under:
Release
I'm pleased to announce the first release 0.1 of FBuild, which you can download here. FBuild is a new way to build software. It's designed around the concept of caching functions, instead of declarative tree building. For instance, this is a simple C fbuildroot.py:
import fbuild
import fbuild.builders.c
def build():
# Create a C builder
static = fbuild.builders.c.guess_static()
# Build some libraries
lib1 = static.build_lib('static1', ['lib1.c'])
lib2 = static.build_lib('static2', ['lib2.c'], libs=[lib1])
# ... an executable that uses those libraries
exe = static.build_exe('static', ['exe.c'], libs=[lib2])
# ... finally run it
fbuild.logger.log(' * running %s:' % exe)
fbuild.execute([exe])
When you run it, you'll get:
determining platform : {'bsd', 'darwin', 'macosx', 'posix'}
looking for program gcc : ok /usr/bin/gcc
checking gcc : ok
checking gcc with -g : ok
checking gcc with -O2 : ok
looking for program ar : ok /usr/bin/ar
looking for program ranlib : ok /usr/bin/ranlib
checking if gcc can make objects : ok
checking if gcc can make libraries : ok
checking if gcc can make exes : ok
checking if gcc can link lib to exe : ok
* gcc : lib1.c -> build/lib1.o
* ar -rc : build/lib1.o -> build/libstatic1.a
* ranlib : build/libstatic1.a
* gcc : lib2.c -> build/lib2.o
* ar -rc : build/lib2.o -> build/libstatic2.a
* ranlib : build/libstatic2.a
* gcc : exe.c -> build/exe.o
* gcc : build/exe.o build/libstatic2.a build/libstatic1.a -> build/static
* running build/static:
5 6
This is a pretty simple example, but FBuild really shines when you need to do something more complex. Here's some of the details of the current release:
- Linux, Apple and Windows support
- C, C++, OCaml, Java, Scala, Bison, and Felix builders
- Multilevel namespaces for builders
- Simple creation of new builders
- Extensive configuration system for c90, c99, most of posix, and other libraries
- On-demand configuration
- Simultaneous building
- Detects file changes via file digests
- Pretty output
- Very speedy
For examples on how to use it, you can read the documentation here.
You'll need either Python 3.0 or Python 3.1, though I'd recommend Python 3.1 since FBuild is much faster with it.
If you need more help, you can ask on our mailing list, or in our irc channel.
flxc: A new driver that will support an interactive felix
posted on May 26, 2009 - 01:36 PM PDT by Erick Tryzelaar
I just committed 6f6559 that adds support for an experimental new driver called flxc that will support a REPL. It's got a ways to go, but here's what it can already do:
# build/debug/bin/flxc -I build/debug/lib --import nugram.flxh --import flx.flx
>>> 1;
... PARSED: call 1 ();
... EXPANDED: call 1 ();
... DESUGARED: call 1 ();
>>> (1 + 2) * 3;
... PARSED: call 1+2*3 ();
... EXPANDED: call 9 ();
... DESUGARED: call 9 ();
>>> val x = 5;
... PARSED: val x = 5;
... EXPANDED: val x = 5;
... DESUGARED: val x: typeof(5);
x := 5;
>>> fun foo (x:int) (y:float) = {
val z = x + 1;
var w = y * 2.0f;
val s = "hello ";
return s + "world!";
}
... PARSED: fun foo(val x: int) (val y: float): <none>
{
val z = x+1;
var w = y*2.0f;
val s = "hello ";
return s+"world!";
}
... EXPANDED: fun foo(val x: int) (val y: float): <none>
{
val z = (add (x, 1));
var w = (mul (y, 2.0f));
val s = "hello ";
return (add (s, "world!"));
}
... DESUGARED: generated curry fun foo(val x: int): <none>
{
body _rqs_foo = c"" requires _rqs_<input>;
fun foo'2(val y: float): <none>
{
body _rqs_foo'2 = c"" requires _rqs_foo;
val z: typeof((add (x, 1)));
z := (add (x, 1));
var w: typeof((mul (y, 2.0f)));
w := (mul (y, 2.0f));
val s: typeof("hello ");
s := "hello ";
return (add (s, "world!"));
}
return foo'2 of (float);
}
It even supports syntax extension:
>>> syntax foo {
requires statements;
svar_def := "foo" sdeclname = sexpr ";" =>#
"""
`(ast_var_decl ,_sr ,(first _2) ,(second _2) none (some ,_4))
""";
};
... PARSED: {/**/;}
... EXPANDED:
... DESUGARED:
>>> open syntax foo;
... PARSED: {/**/;}
... EXPANDED:
... DESUGARED:
>>> foo x = 5;
... PARSED: var x = 5;
... EXPANDED: var x = 5;
... DESUGARED: var x: typeof(5);
x := 5;
How to fix the "AssertionError: src/compiler/ocs/src/ocs.cmxa: no sources or libraries passed in" bug
posted on April 09, 2009 - 11:13 AM PDT by Erick Tryzelaar
If you get this error when you try to build felix, it's because I accidentally committed a reference to the developer url for our branch of ocs. Here's how to fix it. First, make sure you're up to date with a git pull origin. Next, edit .git/config and replace this line:
[submodule "src/compiler/ocs"]
url = felixgit@felix-lang.org:ocs.git
with:
[submodule "src/compiler/ocs"]
url = http://git.felix-lang.org/r/ocs.git
Finally run git submodule init and git submodule update. Now fbuild/fbuild-light should work again. Let me know if this doesn't work for you.
Git guide for developers
posted on April 05, 2009 - 10:51 PM PDT by Erick Tryzelaar
Good evening/morning/afternoon. So once everyone gets me their ssh public key you can start developing on felix. The instructions are slightly different than for the read only access. You will need to use this pattern:
> git clone felixgit@felix-lang.org:$NAME
Like this:
> git clone felixgit@felix-lang.org:felix
Or if you already are using git, you can do this:
> git remote rm origin
> git remote add origin felixgit@felix-lang.org:felix
> git fetch origin
You'll also need to run:
> git submodule init
To get submodules working. Then, introduce yourself to git:
> git config --global user.name "Erick Tryzelaar"
> git config --global user.email "erickt@example.com"
To commit, do:
> git push origin
We're also using submodules now to make it easier to track external projects. Unfortunately they don't update themselves when they're updated. So, when they change, run:
> git submodule update
If you want to modify a submodule, there are some things you have to do. First, you'll need to change from the read-only repository to the writable one:
> cd src/compiler/dypgen
> git remote rm origin
> git remote add origin felixgit@felix-lang.org:dypgen
> git checkout felix
Then make your changes. Make sure your changes are to the felix branch instead of the master branch, as the master branch will track the remote project. After you've made your change, you need to commit to the submodule first, then push the result back to the server. Finally, go back to the felix directory and commit the submodule version change:
> cd src/compiler/dypgen
> git checkout felix
... edit files
> git commit -a -m "committing changes to dypgen"
> git push origin
> cd ../../..
> git commit -a -m "committing submodule change to felix"
Next on to commit messages. The git tools are written to assume that the first line is used as the title, and should be 50 characters or less. The examples I've seen are along the lines of:
Add feature X to Y.
Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Proin a felis in mi placerat commodo.
* foo bar
* baz
gitk --all and git gui are wonderful tools. If you're on the mac, gitx is also really nice, but it doesn't completely replace the other tools.