Skip to content

Commit cd31033

Browse files
committed
Update readme
1 parent 5bbf47d commit cd31033

File tree

1 file changed

+20
-61
lines changed

1 file changed

+20
-61
lines changed

README.md

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,33 @@
1-
# MLscript
1+
# Implementation for Seamless Scope-Safe Metaprogramming through Polymorphic Subtype Inference (Short Paper)
22

3-
What would TypeScript look like if it had been designed with type inference and soundness in mind?
3+
Our artifact implements the quasiquote syntax, type inference algorithm, and code generation on the MLscript compiler.
4+
The artifact consists of two parts:
45

5-
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.
6-
These features can be used to implement expressive class hierarchies as well as extensible sums and products.
6+
- The main project is written in Scala and powered by sbt,
7+
which includes the original MLscript compiler, our implementation, and corresponding test cases for quasiquote;
8+
- The web demo allows users to compile and run general MLscript with our quasiquote system programs directly in browsers
9+
and check type inference and execution results.
710

8-
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.
11+
Our quasiquote system is implemented in the main project, on which the web demo is based.
912

10-
## Getting Started
11-
12-
### Project Structure
13-
14-
#### Sub-Projects
15-
16-
- The ts2mls sub-project allows you to use TypeScript libraries in MLscript. It can generate libraries' declaration information in MLscript by parsing TypeScript AST, which can be used in MLscript type checking.
17-
18-
#### Directories
19-
20-
- The `shared/src/main/scala/mlscript` directory contains the sources of the MLscript compiler.
21-
22-
- The `shared/src/test/scala/mlscript` directory contains the sources of the testing infrastructure.
23-
24-
- The `shared/src/test/diff` directory contains the actual tests.
25-
26-
- The `ts2mls/js/src/main/scala/ts2mls` directory contains the sources of the ts2mls module.
27-
28-
- The `ts2mls/js/src/test/scala/ts2mls` directory contains the sources of the ts2mls declaration generation test code.
29-
30-
- The `ts2mls/jvm/src/test/scala/ts2mls` directory contains the sources of the ts2mls diff test code.
13+
We implement our system as a part of [MLscript](https://github.com/hkust-taco/mlscript) with first-class support.
14+
Both the parser and type checker of code quotation are integrated with the MLscript compiler,
15+
which is written in Scala.
3116

32-
- The `ts2mls/js/src/test/typescript` directory contains the TypeScript test code.
33-
34-
- The `ts2mls/js/src/test/diff` directory contains the declarations generated by ts2mls.
35-
36-
### Prerequisites
17+
## Getting Started
3718

19+
### Software Dependencies
3820
You need [JDK supported by Scala][supported-jdk-versions], [sbt][sbt], [Node.js][node.js], and TypeScript to compile the project and run the tests.
3921

22+
### Installation
4023
We recommend you to install JDK and sbt via [coursier][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.
4124

4225
[supported-jdk-versions]: https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
4326
[sbt]: https://www.scala-sbt.org/
4427
[node.js]: https://nodejs.org/
4528
[coursier]: https://get-coursier.io/
4629

47-
### Running the tests
48-
30+
### Other Instructions
4931
Running the main MLscript tests only requires the Scala Build Tool installed.
5032
In the terminal, run `sbt mlscriptJVM/test`.
5133

@@ -55,38 +37,15 @@ In the terminal, run `sbt ts2mlsTest/test`.
5537
You can also run all tests simultaneously.
5638
In the terminal, run `sbt test`.
5739

58-
### Running tests individually
59-
6040
Individual tests can be run with `-z`.
6141
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).
6242

63-
You can also indicate the test you want in `shared/src/test/scala/mlscript/DiffTests.scala`:
64-
65-
```scala
66-
// Allow overriding which specific tests to run, sometimes easier for development:
67-
private val focused = Set[Str](
68-
// Add the test file path here like this:
69-
"shared/src/test/diff/mlscript/Methods.mls"
70-
).map(os.RelPath(_))
71-
```
72-
73-
To run the tests in ts2mls sub-project individually,
74-
you can indicate the test you want in `ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala`:
75-
76-
```scala
77-
private val testsData = List(
78-
// Put all input files in the `Seq`
79-
// Then indicate the output file's name
80-
(Seq("Array.ts"), "Array.d.mls")
81-
)
82-
```
43+
### Evaluation
44+
Running the main MLscript tests only requires the Scala Build Tool installed.
45+
In the terminal, run `sbt mlscriptJVM/test`.
8346

84-
### Running the web demo locally
47+
To watch for file changes and continuously run the quasiquote tests,
48+
execute `~mlscriptJVM/testOnly mlscript.DiffTests -- -z qq` in the sbt session.
8549

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

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

0 commit comments

Comments
 (0)