Other

fml

ML-family language interpreter in F#

A small programming language from the ML family, written from scratch in F#. A program goes the whole way in it: from source text, through type checking, to a computed result.

fml

About the project

fml is a small programming language from the ML family (functional languages such as OCaml and F#), implemented from scratch in F#. It has four parts: a lexer that splits the program text into tokens, a parser that arranges them into a syntax tree, a type system that checks the program is correct, and an evaluator that computes the result. Together they form a complete chain from source code to result, so a program written in fml can be run straight away.

The challenge

A custom ML-family language is a whole chain in which each stage must agree with the next: what the parser returns has to be typeable, and what passes type checking has to be computable. The type system was the hardest part here.

What we did

  1. 01 A lexer that turns program text into tokens
  2. 02 A parser that builds a syntax tree from the tokens
  3. 03 A type system that checks the program before it is evaluated
  4. 04 An evaluator that computes the program's result
  5. 05 Every stage written from scratch in F#

Related projects

Describe your project.

A free quote comes back within an hour during working hours.

Tell us what you want to build.

A free quote comes back within an hour during working hours. You talk to the person who writes the code.