Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ayazhafiz/plts

A collection of programming languages and type systems.
https://github.com/ayazhafiz/plts

compiler interpreter programming-language programming-language-theory type-systems

Last synced: 10 days ago
JSON representation

A collection of programming languages and type systems.

Awesome Lists containing this project

README

        

import Revision from "../components/revision.tsx"
import {Helmet} from "react-helmet";
import {Box, ThemeProvider, BaseStyles} from "@primer/react";

export default function Layout({children}) {
return (<>

plts





{children}



>);
}

# plts

Implementations of type systems and programming languages I find interesting.

Repository: [gh:ayazhafiz/plts](https://github.com/ayazhafiz/plts).

- [Introductory](#introductory)
- [Flow Typing](#flow-typing)
- [Gradual Typing](#gradual-typing)
- [Typed Assembly](#typed-assembly)
- [Subtyping](#subtyping)
- [Dependent Types](#dependent-types)
- [Effects and Coroutines](#effects-and-coroutines)
- [Roc](#roc)

## Introductory

- [Emulating the Lambda Calculus in TypeScript's Type System](https://ayazhafiz.com/articles/21/typescript-type-system-lambda-calculus): Evaluating the lambda calculus entirely using the TypeScript type system.

- [TAPL](https://github.com/ayazhafiz/plts/blob/base/tapl): Selected
implementations of languages formalized in _Types and Programming Languages_
(Pierce 2002).

- [Tiger][tiger-pg]: A compiler for the Tiger Language of Appel's 1998 [Modern
Compiler Implementation](https://www.cs.princeton.edu/~appel/modern/ml/index.html).

## Flow Typing

- [lang_narrow](https://ayazhafiz.com/lang_narrow): A language with unions,
records, and flow typing. A checker, interpreter, and C code generator is
implemented.

- [Playground](https://ayazhafiz.com/lang_narrow)
- [Blog post](https://ayazhafiz.com/articles/21/lang-narrow)

- [FT][ft-pg]: The FT (flow typing) calculus from David
Pearce's 2012 paper [_Sound and Complete Flow Typing with Unions,
Intersections, and Negations_](https://ecs.wgtn.ac.nz/foswiki/pub/Main/TechnicalReportSeries/ECSTR12-20.pdf).
Like `lang_narrow`, but smaller and proven sound and complete. Includes a
self-designed type inferer guaranteed to infer principal types.
- [Playground][ft-pg]
- [Pearce, 2012](https://ecs.wgtn.ac.nz/foswiki/pub/Main/TechnicalReportSeries/ECSTR12-20.pdf)
- [Blog post](https://ayazhafiz.com/articles/21/type-inference-for-flow-typing): type inference for the calculus

## Gradual Typing

- [gtlc][gtlc-pg]: A compiler for the gradually-typed lambda calculus,
employing the type consistency relation of [Siek and Taha](http://www.schemeworkshop.org/2006/13-siek.pdf) (2006).
The GTLC allows a developer to omit type annotations during development at
the expense of run-time type casts. While the ahead-of-time typechecker will
catch any non-sensical type errors, the runtime system will catch any cast
errors.

The compiler is multi-phase, optimizing, includes an interpretive mode and a
type inferer, and provides code generators to C and TypeScript.

- [Playground][gtlc-pg]
- [Siek and Taha, 2006](http://www.schemeworkshop.org/2006/13-siek.pdf)
- [Type Inference for Gradual Typing (Siek and Vachharajani, 2008)](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.84.4703&rep=rep1&type=pdf)

## Typed Assembly

- [TAL][tal-pg]: A compiler from a System F-like language to the
Typed Assembly Language of [Morrisett, et.al. 1998](https://dash.harvard.edu/handle/1/2797451).
Also includes a compiler to x86 assembly using [Linear Scan Register
Allocation](http://web.cs.ucla.edu/~palsberg/course/cs132/linearscan.pdf)
(Poletto & Sarkar 1999).
- [Playground][tal-pg]

## Subtyping

- [HO21][ho21-pg]: An implementation of the
algorithmic duotyping calculus invented by Huang and Oliveira in
[Distributing Intersection and Union Types with Splits and Duality](https://dl.acm.org/doi/pdf/10.1145/3473594) (2021).
The calculus includes union, intersection, and arrow types in the presence
of non-trivial distributivity rules. The authors' duotyping algorithm is
somewhat novel in that it computes subtyping relationship entirely on
surface types of the language, without normalizing to a form like DNF.
This implementation includes a type-derivation tree generator.

- [Playground][ho21-pg]
- [Huang and Oliveira, 2021](https://dl.acm.org/doi/pdf/10.1145/3473594)

- [simple_sub](https://github.com/ayazhafiz/plts/blob/base/simple_sub): A type system
that supports type inference in the presence of subtyping and polymorphism, as
described by Parreaux's _[The Simple Essence of Algebraic Subtyping](https://lptk.github.io/files/%5Bv1.8%5D%20simple-essence-algebraic-subtyping.pdf)_ (2020). Parreaux's
work distills Dolan's [2017 thesis](https://www.cs.tufts.edu/~nr/cs257/archive/stephen-dolan/thesis.pdf)
on Algebraic Subtyping into a simpler core.

## Dependent Types

- [deptypes](https://github.com/ayazhafiz/plts/blob/base/deptypes): A dependent
type theory as described in Chapter 2 of Pierce's _Advanced Topics in Types
and Programming Languages_.

- [more deptypes](https://github.com/ayazhafiz/plts/pull/3): Additional,
alternate implementations of the basic dependently-typed lambda calculus.

## Effects and Coroutines

- [fx_cap](https://github.com/ayazhafiz/plts/blob/base/fx_cap): implements
effect handlers via monadic translation of the capability-passing style.

- [co_lc](https://github.com/ayazhafiz/plts/blob/base/co_lc): a lambda calculus
with stackful coroutines and defunctionalized calls. Targets a bytecode stack
machine.

- [Playground][co_lc-pg]

## Roc

[cor](https://github.com/ayazhafiz/cor) is a minimalization of
[Roc](https://roc-lang.org) used for experimenting on the language and its
compiler.

- [cor/uls](https://github.com/ayazhafiz/cor/tree/base/experiments/uls): A
language with "unspecialized lambda sets", a novel extension of the
Hindley-Milner type system that supports efficient resolution of ad-hoc
polymorphic usages (a-la typeclasses) during unification.

- [Documentation](https://www.notion.so/rwx/Non-linear-monomorphization-0b26991a028949a285ca77a8ffcff3c5#1930c4eadf08465f9c7b96469f11f664)
- [Playground][uls-pg]

- [cor/refine](https://github.com/ayazhafiz/cor/tree/base/experiments/refine):
An experimental extension of Roc with refinement of types bound in branch
patterns. Provides a flow-typing-like ergonomics for a unification-based HM
system.

Includes an compiler of pattern matching to decision trees, and various
other optimizations.

- [Playground][roc-refine-pg]

- [cor/easy_tags](https://github.com/ayazhafiz/cor/tree/base/experiments/easy_tags):
An experimental extension of Roc with polymorphic variants' type variables
elided in output positions.

- [Playground][roc-easy-tags-pg]

- [cor/compose_fx](https://github.com/ayazhafiz/cor/tree/base/experiments/compose_fx):
A demonstration of composable effects as designed in Roc.

- [Playground][roc-compose-fx-pg]

- [cor/lss](https://github.com/ayazhafiz/cor/tree/base/experiments/lss):
A demonstration of lambda-set specialization as implemented in Roc.
Supports composable effects, as in `compose_fx`.

- [Playground][roc-lss-pg]

[tiger-pg]: https://ayazhafiz.com/plts/playground/tiger
[ft-pg]: https://ayazhafiz.com/plts/playground/ft
[gtlc-pg]: https://ayazhafiz.com/plts/playground/gtlc
[tal-pg]: https://ayazhafiz.com/plts/playground/tal
[ho21-pg]: https://ayazhafiz.com/plts/playground/ho21
[uls-pg]: https://ayazhafiz.com/plts/playground/cor/uls
[roc-refine-pg]: https://ayazhafiz.com/plts/playground/cor/refine
[roc-easy-tags-pg]: https://ayazhafiz.com/plts/playground/cor/easy_tags
[roc-compose-fx-pg]: https://ayazhafiz.com/plts/playground/cor/compose_fx
[roc-lss-pg]: https://ayazhafiz.com/plts/playground/cor/lss
[co_lc-pg]: https://ayazhafiz.com/plts/playground/co_lc