SuperF online demonstration

The code is available on github.

Note: JavaScript code generation (used to evaluate results) is not prefect yet and has rough edges.

Syntax Reference

Feature Type syntax Term syntax
Basic Terms & Types
literals true, false, 0, 1, "", "a", etc. (same syntax)
record { x: int; y: bool } { x = 0; y = false }
selection t.a
polymorphism forall 'a 'b 'c. T t
function int -> int fun x -> x + 1
application F[A] f a
variable 'a x
let binding let x = s in t
pattern matching match t with C1(a, b, c) -> t1 | C2 -> t2
Top-Level Declarations
definition def foo: T rec def foo = t or  def foo = t or just foo = t
algebraic data type datatype Option[A] = Some(A,) || None Some(t), None
type alias type Foo[T] =
  MyClass[(T, T)] -> MyClass[T]
Miscellaneous
array of known size (tuple) (), (int,), (int, int) etc. (), (0,), (0, 1) etc.
array of unknown size Array[int] if ... then (0, 1) else (0, 1, 2)
type ascription t: T
array indexing a[i]
multi-parameter function (int, int) -> int fun (x, y) -> x + y
multi-argument application F[S, T] f(s, t)
tuple-parameter function ((int, int)) -> int fun ((x, y)) -> x + y
tuple-argument application F[(S, T)] f((s, t))