An open API service indexing awesome lists of open source software.

https://github.com/fwcd/tip

Compiler frontend for a small, purely functional programming language
https://github.com/fwcd/tip

Last synced: 4 months ago
JSON representation

Compiler frontend for a small, purely functional programming language

Awesome Lists containing this project

README

          

# Tip
A small, Haskell-like, purely functional programming language.

This repo contains the compiler frontend that parses a source file and emits a (typed) AST.

Note that the project is highly experimental and mostly an attempt to gain a better understanding of how type checking and type inference works in the context of lambda calculus.

The type system is a basic Hindley-Milner system that is heavily inspired by Christoph Hegemann's "Type Inference From Scratch" talk.

## Example

```
let const = \x -> \y -> x in (const "Hello!")
```

The frontend then yields the following, fully-typed expression:

```
(let const = (\x -> \y -> x) :: _a -> _b -> _a
in (const "Hello!" :: _e -> String)) :: _e -> String
```

## Running
`stack run -- [input file] [output file]`

For example:

`stack run -- examples/HelloWorld.tip output/HelloWorld`