Go to file
Fedor Isakov 72b2f0d110 Fix the Equality Introduction rule. 2018-07-18 15:54:51 +02:00
.idea Updated the git configuration 2015-12-28 10:36:45 +01:00
.mps Extract baseLanguageExt and its related tests to a separate project. 2018-07-16 18:56:36 +02:00
coderules Add a dependency on workflow.preset to in order to fix command-line build. Rename ant targets when importing to clearly separate tasks. 2018-07-17 15:09:47 +02:00
doc/img Updated the screenshots. 2017-06-15 13:48:34 +02:00
gradle/wrapper Add gradle wrapper. 2017-06-13 15:53:03 +02:00
samples Fix the Equality Introduction rule. 2018-07-18 15:54:51 +02:00
.gitattributes Initial import 2014-07-03 15:02:07 +02:00
.gitignore Ensure extracted baseLanguageExt stuff can be built from command line. 2018-07-17 15:09:47 +02:00
.travis.yml Add a "check" task for testing all projects at once. Switch travis build to 'gradle check'. 2018-07-17 15:09:47 +02:00
README.md Remove reference to specific version of MPS. 2017-12-06 18:22:43 +01:00
build.gradle Include lambdacalc sample into the common build. 2018-07-18 15:54:50 +02:00
build.xml Add a dependency on workflow.preset to in order to fix command-line build. Rename ant targets when importing to clearly separate tasks. 2018-07-17 15:09:47 +02:00
gradle.properties Ensure extracted baseLanguageExt stuff can be built from command line. 2018-07-17 15:09:47 +02:00
gradlew Add gradle wrapper. 2017-06-13 15:53:03 +02:00
gradlew.bat Add gradle wrapper. 2017-06-13 15:53:03 +02:00
settings.gradle Include lambdacalc sample into the common build. 2018-07-18 15:54:50 +02:00
updatePlugins.xml Bumped up the plugin version in updatePlugins.xml 2017-12-04 12:51:59 +01:00

README.md

Type Checking with Constraint Rules

An experimental feature for JetBrains MPS implementing a better type checking and type inference using constraint rules.

Status

Build Status

The status of this project is pre-release. Dont rely on any of the language features or the API to be stable. The purpose of this project is to show the new technology and collect early feedback.

Overview

This project is the result of the research done within the MPS team in the area of code analysis using constraint rules, in particular CHR.

Typing rules serve as templates that produce constraint rules. Both transformation to constraint rules and evaluating is done in-memory at the time type checking is launched. Constraint rules are processed by the embedded engine.

The source code also contains the typing rules for baseLanguage, which serve to demonstrate how the various type inference problems are solved.

Features

The language jetbrains.mps.typesystem2 enables to write typing rules. A custom aspect «types» is used to store the typing rules in the language source code.

Example of a typing rule

Type checking plugin for MPS provides the actions for checking the types in a currently opened root.

Constraints activation trace view for debugging the process of evaluating constraint rules.

Activation trace

Once finished, the constraint rules produce the inferred types and type errors, which are added as highlighter annotations to the editor.

Dependencies

The source code can be opened with the latest version of JetBrains MPS. The plugin that is created with the build script is also compatible with the same version of MPS.

Installation

The easiest way to install the plugin is by using the update mechanism built in to JetBrains MPS.

  1. Open the Preferences dialog and select Plugins on the left
  2. In the panel on the right select Browse Repositories…
  3. In the dialog that appears select Manage Repositories…
  4. Add a new repository with the following url:
https://raw.githubusercontent.com/fisakov/constraints-typechecking/updates/updatePlugins.xml
  1. The list of plugins should be refreshed and the new plugin «typechecking» should appear
  2. Install the plugin and restart the application.

Alternatively, the plugin can be installed manually. See the downloads section of the latest release for the plugin archive. This archive has to be unpacked to the MPS plugins folder on your local drive. For example (using macOS):

unzip typechecker-0.2.zip -d ~/Library/Application\ Support/MPS2017.2/

Hacking

The project is built using gradle. To work with the source code, follow these steps:

  1. Install JetBrains MPS using this link.

  2. Clone this repository to your local drive.

  3. [optional] In the project folder put a symlink called «MPS_HOME» that leads to the MPS home folder:

    ln -s /Applications/MPS\ 2017.1.app/Contents MPS_HOME

    By doing so you skip unpacking the MPS distribution by the gradle script.

  4. Run gradle using the following command to generate all models:

    ./gradlew generate

    In order to execute full build, including artefacts, run this command:

    ./gradlew build

    If you want to run the tests as well as building the project, execute this instead:

    ./gradlew test

  5. The project is now ready to be opened with MPS.

    NOTE: every time the source tree is cleaned, for example with git clean command, the gradle script has to be run in order to download the necessary libraries.

License

Copyright 2014-2017 JetBrains s.r.o.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.