This is an experimental programming language used for learning, written in OCaml 4.06.1
.
- Simple arithmetics (
+
,-
,*
,/
,>
,<
) with precences int
andbool
typeslet
bindings andif
expressions- Closures
fun x: int -> x*x
- Strict, static typechecker
- Partial evaluation:
- Multiple argument functions
- Print type of arbitrary expressions
- Unit type
- Tuples
- REPL
$ dune build repl.exe && dune exec ./repl.exe
> let a = ((fun x:(int) -> fun y:(int) -> x+y) 12) in a 122
int :: (Eval.Int 134)
> (fun x:(int->int->int) -> x 4 5) (fun x:(int) y:(int) -> x+y)
int :: (Eval.Int 9)
> (fun x:(int->int*int->int) -> (x 1 (1,1))+1) (fun x:(int) y:(int*int) -> 99)
int :: (Eval.Int 100)
- Better syntax errors, OMG PLEASE, especially in
*
(Kleene star) rules - Better typechecking errors
- Recursive functions
- Use a typed AST to build the base for type inference
- Records
- Sum types
- Lists
- Recusive types
- Hindley-Milner type system on System F
- Explore structural vs nominal typing
- Linear types
- Typeclasses
- Algebaic effects
- Concurrency and Parallelism (API via algebraic effects, monads)
- Dependent types
- Compilation to:
- Assembly
- LLVM
- C
- Go
- JS
- Virtual machine (maybe written in rust)
- Types and programming languages (Benjamin C. Pierce)
- Programming language Zoo
- Modern Compiler implementation in ML (Andrew Appel)