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
- Host: GitHub
- URL: https://github.com/fwcd/tip
- Owner: fwcd
- License: bsd-3-clause
- Created: 2020-07-08T18:06:38.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-11-04T01:52:55.000Z (over 5 years ago)
- Last Synced: 2025-04-07T15:17:33.023Z (about 1 year ago)
- Language: Haskell
- Homepage:
- Size: 47.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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`