Felix is yet another programming language so what special features does it have?
-
[Please clearly disclose your affiliation with the Felix project if you don't want to be identified as a spammer](https://stackoverflow.com/help/promotion). And please note that any questions you ask must still be on-topic as defined in the [help/on-topic], even if you are answering your own question. – ChrisGPT was on strike Feb 11 '21 at 23:01
1 Answers
Felix is a high performance scripting language which generates efficient C++. It's motto is hyperlight meaning it is intended to run faster than C. This is achieved by extensive static whole program analysis and inlining.
The language is used like Python by simply running scripts:
flx hello.flx
but underneath your code is translated to C++ and compiled to machine binary and then run. Extensive dependency checking and caching optimises build time automatically, and a pkgconfig like database is used to fully automate linking external libraries, including the Felix run time. C, Objective C, C++, and Objective C++ can also be compiled and linked, and can also use the autolinking feature, allowing C++ code to be run like a script too: say goodbye to makefiles and build systems!
The language provides an optional garbage collector, but also supports manual memory management, it conforms to your system C++ compiler ABI and allows embedding C++ types and functions easily:
type Int = "int";
const One : Int = "1";
fun +: Int * Int -> Int = "$1+$2";
proc show: Int = "::std::cout << $1 << ::std::endl;"
requires header '#include <iostream>'
;
show (One + One + One);
Felix has a sophisticated high power first order type system including explicit kinding constraints, parametric polymorphism, Haskell style type classes, Ocaml style polymorphic variants, and supports polyadic (rank independent) array programming using compact linear types.
Felix appears as a traditional Algol like procedural language with a very strong functional programming subsystem, including support for Monads. However the procedural coding model is based on coroutines using channels to communicate. The resulting lightweight threading model can be elevated to true concurrency, achieving Go-lang performance without sacrificing C/C++ compatibility.
Whilst many programming language now provide operator overloading, and some even allow user defined operators, Felix goes a lot further by placing the whole grammar in the user library. This allows the programmer to design Domain Specific Sub-Languages (DSSLs). For example the Regular Definition DSSL allows one to write:
regdef cident = (underscore | letter) (underscore | letter | digit)*;
using a BNF like syntax, the grammar for which is defined in user space. Similarly bindings to objective C can be conveniently expressed using the ObjC DSSL.
- Source: https://github.com/felix-lang/felix
- Homepage: http://felix-lang.org
- Some docs: https://felix.readthedocs.io/en/latest/index.html

- 4,725
- 1
- 20
- 29