Questions Concepts
GitHub icon

Felix

Felix - Programming language

< >

Felix is a programming language created in 2001 by John Skaller.

Source code:
git clone https://github.com/felix-lang/felix
#524on PLDB 22Years Old

The Felix Programming Language


Example from the web:
#import <flx.flxh> fun abs_div(a:int, b:int when b!=0) expect result >=0 => abs(a/b) ; print (abs_div(2,4)); print "\n";
Example from hello-world:
println$ "Hello World";
Felix Keywords
_ _deref all as assert attempt call callback case caseno cclass code compound ctypes do done downto elif else endattempt endcase endif endmatch enum except exceptions expect finally for forall forget fork functor goto ident if incomplete inherit instance interface jump lambda loop match module namespace new noexpand nonterm obj of open parse raise regexp reglex regmatch rename return the then to type typecase typedef typematch typeof upto when whilst with yield

Language features

Feature Supported Token Example
Binary Literals
// 0[Bb][01_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Integers
// (0|[1-9][0-9_]*)([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Floats
// 0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[lLfFdD]?
Hexadecimals
// 0[xX][0-9a-fA-F_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Octals
// 0[0-7_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Conditionals
Strings "
"Hello world"
Print() Debugging println
Comments
// A comment
Line Comments //
// A comment
Pattern Matching
match x with
 | Some x => println$ x; 
 | None => println "NONE";
 endmatch;
Polymorphism
// overloads
fun f (x:double) => x +42.1;
fun f (x:int) =>  x + 1;
fun f (x:string) => x + "!";
Generics
// generics
fun g (x) => f (f x);
println$ g 1, g "hello";
println$ _map f (1,"hello",2.0);
Pointers
var x = 1;
&x <- 2;
Semantic Indentation X

HackerNews discussions of Felix

title date score comments
Felix - a fast scripting language 01/04/2013 107 83

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · feedback@pldb.com · Logout