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, garbage 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
FBuild 0.2
posted on August 30, 2010 - 10:19 AM PDT
by Erick Tryzelaar
filed under:
FBuild
I'm pleased to announce FBuild version 0.2. It's been way too long since the last FBuild release, but a lot of features have been added over the past year. Overall, the core concept of FBuild is still the same, but there have been some structural changes in response to some suggestions I've had.
The most obvious change is that there is now a context object that you must pass around in order to interact with cacheable functions. Now, to write a simple builder, you must do:
import fbuild.builders.c
def build(ctx):
shared = fbuild.builders.c.guess_shared(ctx)
shared.build_exe('foo', ['foo.c', 'bar.c'])
Next is the support for command line targets. This allows you to easily call a specifically marked function, as in:
import fbuild.builders.ocaml
def build(ctx):
ocamlc = fbuild.builders.ocaml.Ocamlc(ctx)
ocamlc.build_exe('foo', ['foo.ml'])
import fbuild.target
@fbuild.target.register(name='run-test', help='run the foo test')
def run_test(ctx):
# make sure 'foo' is built
build(ctx)
ctx.execute([ctx.buildroot / 'foo', 'world'])
ctx.execute([ctx.buildroot / 'foo', 'fbuild'])
Which can be run by:
% fbuild run-test
looking for program ocamlc.opt : ok /opt/local/bin/ocamlc.opt
looking for program ocamldep.opt : ok /opt/local/bin/ocamldep.opt
determining platform : {'bsd', 'darwin', 'macosx', 'posix'}
checking if ocamlc.opt can make objects : ok
checking if ocamlc.opt can make libraries: ok
checking if ocamlc.opt can make exes : ok
checking if ocamlc.opt can link lib to exe: ok
* ocamldep.opt : foo.ml
* ocamlc.opt : build/foo.ml -> build/foo.cmo
* ocamlc.opt : build/foo.cmo -> build/foo
Hello world
Hello fbuild!
One nice feature of the targets is that they are automatically integrated into the "--help" option:
% fbuild -h
Usage: fbuild-light [options] target1 [target2 target3 ...]
...
Targets:
build
run-test run the foo test
Next up is another removal of magic, this time in fbuild.config.c. Now, if
you want to define a config test that requires a header, you must explicitly
define it yourself, as in:
import fbuild.config.c as c
class assert_h(c.Test):
header = c.header_test('assert.h')
Finally, the last major addition was support for Linux's LD_LIBRARY_PATH and OS X's DYLD_LIBRARY_PATH for shared libraries. Now it's much easier to execute test code that depends on a shared library. To use it, just do:
ctx.execute(cmd, runtime_libpaths=['lib1', 'lib2'])
Beyond that, we added builders for ghc, avr-gcc, gcc/iOS, O'Caml Findlib, and O'Caml Batteries. For configuration support, we now can check for SDL, LLVM, GNU Readline, GNU GMP, Google Test Framework, and OpenSSL. And, of course, lots of miscellaneous bug fixes. For a more detailed breakdown, please look at our git history.
Oh and one last thing. FBuild-0.2's build/ directory is incompatible with FBuild-0.1's build/ directory, so you'll have to remove the old directory before you can compile.
Please let us know if you run into any problems or need any help. You can:
- File a bug at http://github.com/erickt/fbuild/issues
- Contact our mailing list at http://groups.google.com/group/fbuild
- Or find us on IRC on freenode.net in #felix
Transitioning over to github.
posted on August 16, 2010 - 12:05 PM PDT
by Erick Tryzelaar
filed under:
FBuild,
Felix
I just wanted to let everyone know that I'm transitioning the hosting of felix and fbuild over to github. You can find the following repositories over there:
- felix: http://github.com/erickt/felix
- felix2 (my unannounced prototype new felix frontend): http://github.com/erickt/felix2
- fbuild: http://github.com/erickt/fbuild
- dypgen mirror: http://github.com/erickt/dypgen
- ocs mirror: http://github.com/erickt/ocs
I'll still be maintaining the http://git.felix-lang.org mirrors, but I'm considering github to be the primary location to get the code, as well as for bug tickets and etc.
We finally own #felix!
posted on August 16, 2010 - 11:20 AM PDT
by Erick Tryzelaar
filed under:
FBuild,
Felix
Hi all, long time no see! I just wanted to say that we now officially own #felix for all your felix and fbuild related stuff. So hop on by if you want to chat :)
Example python extension builder
posted on December 30, 2009 - 02:03 PM PST
by Erick Tryzelaar
filed under:
FBuild
Holger on the fbuild mailing list was trying to use fbuild to create python c extensions, so I mocked up a simple builder for him. There's a little work looking up the include directory, and I'm hardcoding the gcc option "-undefined dynamic_lookup", but once done it's pretty simple:
import fbuild.builders.c
import fbuild.db
import fbuild.path
@fbuild.db.caches
def python_c_builder(ctx, python='python'):
"""Creates and returns a python C extension builder."""
# If we didn't explicitly chose which version of python to use, search the
# environment for python.
python = fbuild.builders.find_program(ctx, [python])
# Create a helper program that calls out to python to get the include and
# lib directories.
stdout, stderr = ctx.execute([python, '-c',
'import distutils.sysconfig; '
'print(distutils.sysconfig.get_python_inc())'],
quieter=1)
includepath = stdout.decode().strip()
# Return a fully specified python c extension builder.
return fbuild.builders.c.guess_shared(ctx,
includes=[includepath],
flags=['-undefined', 'dynamic_lookup'],
lib_prefix='',
lib_suffix='.so')
def build(ctx):
for python in ('python', 'python2.5', 'python2.6', 'python3.1'):
# Configure the python.
shared = python_c_builder(ctx, python)
# Copy the src file so we don't have collisions.
fbuild.path.Path('build/%s' % python).makedirs()
fbuild.path.Path('spam.c').copy('build/%s' % python)
# Build the extension module.
shared.build_lib('%s/spam' % python, ['build/%s/spam.c' % python])
# Test if we can actually import the module.
ctx.execute([python, '-c', 'import spam; spam.system("echo hello world!")'],
cwd='build/%s' % python)
Which results in:
looking for program python : ok /opt/local/bin/python
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
checking gcc with -undefined dynamic_lookup -fPIC: ok
checking gcc with -undefined dynamic_lookup -dynamiclib: ok
checking gcc with -undefined dynamic_lookup: ok
checking if gcc -undefined dynamic_lookup -fPIC can make objects: ok
checking if gcc -undefined dynamic_lookup -fPIC can make libraries: ok
checking if gcc -undefined dynamic_lookup -fPIC can make exes: ok
checking if gcc -undefined dynamic_lookup -fPIC can link lib to exe: ok
* gcc -undefined dynamic_lookup -fPIC : build/python/spam.c -> build/python/spam.os
* gcc -undefined dynamic_lookup -dynamiclib: build/python/spam.os -> build/python/spam.so
hello world!
looking for program python2.5 : ok /opt/local/bin/python2.5
checking gcc : ok
checking gcc with -g : ok
checking gcc with -O2 : ok
checking gcc with -undefined dynamic_lookup -fPIC: ok
checking gcc with -undefined dynamic_lookup -dynamiclib: ok
checking gcc with -undefined dynamic_lookup: ok
checking if gcc -undefined dynamic_lookup -fPIC can make objects: ok
checking if gcc -undefined dynamic_lookup -fPIC can make libraries: ok
checking if gcc -undefined dynamic_lookup -fPIC can make exes: ok
checking if gcc -undefined dynamic_lookup -fPIC can link lib to exe: ok
* gcc -undefined dynamic_lookup -fPIC : build/python2.5/spam.c -> build/python2.5/spam.os
* gcc -undefined dynamic_lookup -dynamiclib: build/python2.5/spam.os -> build/python2.5/spam.so
hello world!
looking for program python2.6 : ok /opt/local/bin/python2.6
* gcc -undefined dynamic_lookup -fPIC : build/python2.6/spam.c -> build/python2.6/spam.os
* gcc -undefined dynamic_lookup -dynamiclib: build/python2.6/spam.os -> build/python2.6/spam.so
hello world!
looking for program python3.1 : ok /opt/local/bin/python3.1
checking gcc : ok
checking gcc with -g : ok
checking gcc with -O2 : ok
checking gcc with -undefined dynamic_lookup -fPIC: ok
checking gcc with -undefined dynamic_lookup -dynamiclib: ok
checking gcc with -undefined dynamic_lookup: ok
checking if gcc -undefined dynamic_lookup -fPIC can make objects: ok
checking if gcc -undefined dynamic_lookup -fPIC can make libraries: ok
checking if gcc -undefined dynamic_lookup -fPIC can make exes: ok
checking if gcc -undefined dynamic_lookup -fPIC can link lib to exe: ok
* gcc -undefined dynamic_lookup -fPIC : build/python3.1/spam.c -> build/python3.1/spam.os
* gcc -undefined dynamic_lookup -dynamiclib: build/python3.1/spam.os -> build/python3.1/spam.so
hello world!
I should be able to get a prototype builder out soon.