andongfan / mlscript-core-language

Codebase for the paper "MLscript: Principal Type Inference in a Boolean Algebra of Structural Types"

Home Page:https://hkust-taco.github.io/mlscript-core-language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository contains an implementation of the core language of MLscript, in a way that is faithful to the paper and that does not contain all the bells and whistles and extra features of the full MLscript.

MLscript Core Language

What would TypeScript look like if it had been designed with type inference and soundness in mind?

We provide one possible answer in MLscript, an object-oriented and functional programming language with records, generic classes, mix-in traits, first-class unions and intersections, instance matching, and ML-style principal type inference. These features can be used to implement expressive class hierarchies as well as extensible sums and products.

MLscript supports union, intersection, and complement (or negation) connectives, making sure they form a Boolean algebra, and add enough structure to derive a sound and complete type inference algorithm.

Running the tests

Running the tests only requires the Scala Build Tool installed. In the terminal, run sbt mlscriptJVM/test.

To run the regression tests continuously as you develop, launch the SBT shell first with sbt and then type ~mlscriptJVM/testOnly mlscript.DiffTests.

Running the demo locally

To run the demo on your computer, compile the project with sbt fastOptJS, then open the local_testing.html file in your browser.

You can make changes to the type inference code in shared/src/main/scala/mlscript, have it compile to JavaScript on file change with command sbt ~fastOptJS, and immediately see the results in your browser by refreshing the page with F5.

About

Codebase for the paper "MLscript: Principal Type Inference in a Boolean Algebra of Structural Types"

https://hkust-taco.github.io/mlscript-core-language


Languages

Language:Scala 98.8%Language:HTML 0.7%Language:CSS 0.4%Language:TypeScript 0.0%