Coder Social home page Coder Social logo

ayazhafiz / plts Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 3.0 161.3 MB

A collection of programming languages and type systems.

Home Page: https://ayazhafiz.com/plts

OCaml 90.87% Makefile 0.21% Forth 0.02% Shell 0.46% Dockerfile 0.11% JavaScript 0.94% TypeScript 6.53% CSS 0.03% Standard ML 0.12% Agda 0.03% Vim Script 0.01% FLUX 0.02% HLSL 0.08% MDX 0.58%
programming-language-theory type-systems programming-language compiler interpreter

plts's Introduction

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

export default function Layout({children}) { return (<> <title>plts</title> <Box m={[4, 4, 10]}>{children} </>); }

plts

Implementations of type systems and programming languages I find interesting.

Repository: gh:ayazhafiz/plts.

Introductory

Flow Typing

Gradual Typing

  • gtlc: A compiler for the gradually-typed lambda calculus, employing the type consistency relation of Siek and Taha (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.

Typed Assembly

Subtyping

  • HO21: An implementation of the algorithmic duotyping calculus invented by Huang and Oliveira in Distributing Intersection and Union Types with Splits and Duality (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.

  • 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 (2020). Parreaux's work distills Dolan's 2017 thesis on Algebraic Subtyping into a simpler core.

Dependent Types

  • deptypes: A dependent type theory as described in Chapter 2 of Pierce's Advanced Topics in Types and Programming Languages.

  • more deptypes: Additional, alternate implementations of the basic dependently-typed lambda calculus.

Effects and Coroutines

  • fx_cap: implements effect handlers via monadic translation of the capability-passing style.

  • co_lc: a lambda calculus with stackful coroutines and defunctionalized calls. Targets a bytecode stack machine.

Roc

cor is a minimalization of Roc used for experimenting on the language and its compiler.

  • cor/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.

  • cor/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.

  • cor/easy_tags: An experimental extension of Roc with polymorphic variants' type variables elided in output positions.

  • cor/compose_fx: A demonstration of composable effects as designed in Roc.

plts's People

Contributors

ayazhafiz avatar circle-test avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hsk zen3d ziord

plts's Issues

[gtlc] Optimize: remove unused parameters/variables

Finding unused variables is trivial, but removing them safely is trickier. If we remove an unused parameter, we need to update all places a value for that parameter is passed, which is non-trivial to figure out (consider using a graph representation of types here to make this easier; we only need to update the type once and then look at all values elaborated with that type).

The other issue to be careful of is the interaction with references. This is best illustrated by an example; consider the program

let a = ref (\x: _. 0) in
a := (\x: nat. x);
!a 1

applying the optimization naively would yield

let a = ref (\: 0) in
a := (\x: nat. x);
!a ()

but the problem is that a now has the type ref ([] -> nat), but then assigned a value of type [nat] -> nat, and the optimized-away call at the end is now unsound.

Nevertheless there are ways to handle this; as an initial pass, we could simply avoid modifying functions later used inside references.

[gtlc] Better UX for inferred types

  • Mark inferred types as `T, not just when being inferred
  • Autofix/hover provider to show inferred type in playground
  • Make program expression printing prettier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.