EseML Compiler

"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.

Definition

The definition of eseML was published and distributed at Comic Market 71, 2006, Japan.

Online edition will be available later.

Errata

Implementation

Latest Snapshot

Previous Snapshot

Brief description

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

Sample

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)

© 2006, 2007 UENO Katsuhiro.
stylesheet prints mail address here.