The tal package

[Tags:library, mit]

From System F to Typed-Assembly Language


[Skip to Readme]

Properties

Versions 0.1.0.0
Dependencies base (>=4.7 && <5), containers, mtl, pretty, transformers, unbound [details]
License MIT
Copyright 2015 Stephanie Weirich
Author Stephanie Weirich
Maintainer sweirich@cis.upenn.edu
Category Language
Home page https://github.com/sweirich/tal
Source repository head: git clone https://github.com/sweirich/tal
Uploaded Tue Aug 23 17:23:04 UTC 2016 by sweirich
Distributions NixOS:0.1.0.0
Downloads 49 total (5 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-08-23 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for tal

Readme for tal-0.1.0.0

An implementation of a type-preserving Compiler, derived from the paper

From System F to Typed Assembly Language by Morrisett, Walker, Crary, Glew

I was inspired to implement this paper while preparing a talk for Papers We Love Philadelphia.

The implementation includes all passes described in the paper:

  • F ==> K (Typed CPS conversion)
  • K ==> C (Polymorphic closure conversion)
  • C ==> H (Hoisting, reuses the C language)
  • H ==> A (Allocation)
  • A ==> TAL (Code generation)

Each language (F, K, C, A, TAL) is defined in the corresponding source file. These implementations include the abstract syntax, small-step operational semantics, and type checker for the languages. The file Util.hs contains definitions common to all implementations.

The compiler itself is in the file Translate.hs. To run the compiler, load this file into ghci and try out one of the sample programs from F.hs.

In particular, you can try

 Translate*> printM $ compile F.sixfact

to see the TAL output for the factorial function applied to six.

If you would like to compile and then run this function you can try:

 Translate*> test F.sixfact