"EseML" is a fakish functional programming language, which has very fakish grammar like Standard ML, Objective Caml or Haskell, and very fakish type system and operational semantics derived from Standard ML.
("Ese" means fake or pseudo, in Japanese.)
More information about eseML will be available soon.
The definition of eseML was published and distributed at Comic Market 71, 2006, Japan.
Online edition will be available later.
The whole of eseML program must be an expression, and its type must be string → string.
exp ::= ( exp ) | const | varid | ( infixid ) | { pat pat ... pat -> exp } | ( exp , ... , exp ) | conid exp | exp exp | infixid exp | exp infixid exp | pat -> exp | case exp if ( pat , ... , pat ) -> exp | case exp match* | if exp then exp else exp | exp and exp | exp or exp | decls in exp
Fibonacci
let fun fst x = case x if (x,y) -> x fun fib n = if n == 0 or n == 1 then 1 else fib (n - 1) + fib (n - 2) in { x -> showInt (fib (fst (scanInt x))) `strcat` "\n" }
How to compile and execute ($ is shell prompt):
$ eseml fib.es # fib.es.c will be generated. $ gcc -o fib fib.es.c $ echo 0 | ./fib - # input from standard input 1 $ echo 1 | ./fib - 1 $ echo 2 | ./fib - 2 $ echo 10 | ./fib - 89 $ echo 20 > n.txt $ ./fib n.txt # input from n.txt 10946 # fib(20)