Skip to content

hkust-taco/metaprogramming-web-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

22eaf60 · Oct 22, 2024
Oct 3, 2024
Sep 29, 2023
May 20, 2024
Oct 4, 2024
Sep 28, 2023
Oct 22, 2024
Oct 3, 2024
Oct 22, 2024
Jun 12, 2020
Feb 1, 2024
Sep 29, 2022
Mar 17, 2023
Nov 28, 2023
May 30, 2023
Sep 3, 2024
Oct 3, 2024
Oct 3, 2024
Oct 3, 2024
Mar 1, 2023
May 20, 2024
May 20, 2024
Sep 8, 2022
Sep 8, 2022
Jun 12, 2020

Repository files navigation

Implementation for Seamless Scope-Safe Metaprogramming through Polymorphic Subtype Inference (Short Paper)

Our artifact implements the quasiquote syntax, type inference algorithm, and code generation on the MLscript compiler. The artifact consists of two parts:

  • The main project is written in Scala and powered by sbt, which includes the original MLscript compiler, our implementation, and corresponding test cases for quasiquote;
  • The web demo allows users to compile and run general MLscript with our quasiquote system programs directly in browsers and check type inference and execution results.

Our quasiquote system is implemented in the main project, on which the web demo is based.

We implement our system as a part of MLscript with first-class support. Both the parser and type checker of code quotation are integrated with the MLscript compiler, which is written in Scala.

Getting Started

Software Dependencies

You need JDK supported by Scala, sbt, Node.js, and TypeScript to compile the project and run the tests.

Installation

We recommend you to install JDK and sbt via coursier. The versions of Node.js that passed our tests are from v16.14 to v16.17, v17 and v18. Run npm install to install TypeScript. Note that ScalaJS cannot find the global installed TypeScript. We explicitly support TypeScript v4.7.4.

Other Instructions

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

Running the ts2mls MLscript tests requires NodeJS, and TypeScript in addition. In the terminal, run sbt ts2mlsTest/test.

You can also run all tests simultaneously. In the terminal, run sbt test.

Individual tests can be run with -z. For example, ~mlscriptJVM/testOnly mlscript.DiffTests -- -z parser will watch for file changes and continuously run all parser tests (those that have "parser" in their name).

Evaluation

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

To watch for file changes and continuously run the quasiquote tests, execute ~mlscriptJVM/testOnly mlscript.DiffTests -- -z qq in the sbt session.

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