Whimsy is a research project that aims to make writing compilers, transpilers and source analysis tools easier by supplying easy to use facilities embedded in a general programming language.
Whimsy currently comprises two parts:
- Autumn: a parsing library.
- Uranium: a middle-end compiler library.
Uranium annotates ASTs and computes over them, using a reactive architecture.
It also comes with a few examples:
Autumn is a Kotlin parser combinator library written in with an unmatched feature set:
- Bundles pre-defined parsers and combinators for most common use cases
- Write your own parsers with regular Kotlin/Java code
- Scannerless, but with tokenization support
- Associativity & precedence support for operators
- Left-recursion support
- Context-sensitive parsing !!
- Pluggable error-reporting mechanism
- Reasonably fast (3x slower than ANTLR)
- Thoroughly documented
- Small & clean codebase
Uranium is currently a work in progress.
In all cases, you will still need Kotlin installed, either as part of IntelliJ IDEA or on the command line.
In your pom.xml
, add the following inside <project><repositories>
:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
and the following inside <project><dependencies>
:
<dependency>
<groupId>com.github.norswap</groupId>
<artifactId>whimsy</artifactId>
<version>-SNAPSHOT</version>
</dependency>
In your build.gradle
, add the following inside allprojects { repositories {
:
maven { url 'https://jitpack.io' }
and the following inside dependencies {
:
compile 'com.github.norswap:whimsy:-SNAPSHOT'
See https://jitpack.io/#norswap/whimsy
Download the latest release kotlin-fatjar
and add it on your project's classpath.
The release bundles Whimsy's only dependency: the Apache BCEL library, but renames its packages to avoid any possibility of conflict.
The fatjar also includes test fixtures to help you build your own tests. Those depend on the TestNG library (built with version 6.11 but should be more broadly compatible), which is not bundled in.
See the Developer Guide.