Felix is a programming language created in 2001 by John Skaller.
#358on PLDB | 23Years Old |
git clone https://github.com/felix-lang/felix
The Felix Programming Language
#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";
println$ "Hello World";
_ _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
Feature | Supported | Example | Token |
---|---|---|---|
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 |
title | date | score | comments |
---|---|---|---|
Felix - a fast scripting language | 01/04/2013 | 107 | 83 |