mattpaletta / typecheck

Language agnostic type checking framework for language-implementers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typecheck

This project is a language-agnostic typechecker. It is designed to be abstract from any particular language, but rather provide a framework that language-implementers can use to handle typechecking their statically-typed languages.

Motivation

This project was created out of my own need for a typechecker for my own compiler for pseudocode (soon to be open-sourced). I decide to separate the typechecker firstly so it could be easily tested as a different project, and secondly so I, and others, could use it for other projects in the future and benefit from any improvements made to this library over time. You can see other projects using the project on the THIRD_PARTY.md file in this repo.

Build Status

Build Status

Getting Started

To save this document from getting too long, this has been moved to a separate document, GettingStarted.md, found in this repo. This goes over the API at a high-level. For more examples, you can find tests in the test/ folder.

Code Style

Code style is checked by clang-tidy (ON by default). You can check it by running with:

cd ${PROJECT_ROOT}/build
cmake -DENABLE_CLANG_TIDY=ON ..

Build Options

The supported build tool is CMake. All of the CMake build options have been placed in a single file, which you can view here: CMake Build Options

Supported Platforms

Currently being tested using Travis CI on Windows, Mac, and Ubuntu, compiling with:

  • MSVC
  • gcc
  • clang

Typecheck requires C++17.

Dependencies

This library is designed to generally use versions of libraries pre-installed on your system, but if they are not available, build them from source automatically. Libraries this project depends on:

How to use?

This project was build for, and is used in my own project: Pseudocode (Soon to be opensourced, if not already.)

fetch_extern(typecheck https://github.com/mattpaletta/typecheck master)

I use FetchContent to along with a helper function to grab this library. You can see that function here: fetch_extern. Alternatively, you can add it as a git submodule include the directory:

add_subdirectory(typecheck)

You can then link it to your project:

add_library(my_library ...)
target_link_libraries(my_library PUBLIC ... typecheck ...)

Contribute

I welcome contributions of all sorts. I consider myself new to the open-source community, so if you're looking for things to contribute, here are some ideas to get started:

  • Spelling errors in comments & variable names
  • Improve test coverage + add edge cases (build with ENABLE_COVERAGE)
  • Improvements on performance, readability, etc.
  • Suggestions or ideas of larger improvements (leave an issue, and we can discuss)
  • Improvements to documentation or code comments to add or update where relevant

Credits

The algorithm used in this project are heavily influenced by the Hindley-Milner type system and the Swift type checker. Some of the excellent resources used are listed below:

Information

Questions, Comments, Concerns, Queries, Qwibbles?

If you have any questions, comments, or concerns please leave them in the GitHub Issues Tracker

Bug reports

If you discover any bugs, feel free to create an issue on GitHub. Please add as much information as possible to help us fixing the possible bug. We also encourage you to help even more by forking and sending us a pull request.

Maintainers

License

GPL-3.0 License. Copyright 2020 Matthew Paletta. http://mrated.ca

About

Language agnostic type checking framework for language-implementers.


Languages

Language:C++ 76.5%Language:CMake 23.5%