/lexi

A multi-language and multi-target modular research compiler designed for easy modification with first-class plugin support.

Primary LanguageJava

Lexi Compiler

A multi-language and multi-target modular research compiler designed for easy modification with first-class plugin support.

Lexi is not just a standard compiler; it will also provide metaprogramming capabilities for you to use with existing compilers, including parsing and type system APIs.

Current State

Lexi is in its infancy and will not be available for production use any time soon.

Install Lexi

macOS

brew install lexi-compiler/tap/lexi

Or brew tap lexi-compiler/tap and then brew install lexi.

Documentation

Read all about Lexi at lexi-compiler.io

Run Tests

Quick Dev Guide

Make sure you have sbt version 1.4.x.

Running Tests

To execute all compiler tests: sbt test

Build Compiler

Build Java jar file which will generate a jarfile under target/scala-3.0.0-M3/lexi-assembly-0.1.0-SNAPSHOT.jar:

sbt assembly

Or build native image via GraalVM native-image under target/graalvm-native-image/lexi:

sbt graalvm-native-image:packageBin

To test the compiler build was successful:

$ java -jar target/scala-3.0.0-M3/lexi-assembly-0.1.0-SNAPSHOT.jar -lang kotlin "val x: Int = 5"
$ Some(IrFile(None,Some(Vector(IrTopLevelObject(Some(IrDeclaration(Some(IrProperty(Some(x),Some(5),Some(Int))),None)))))))
$ target/graalvm-native-image/lexi -lang kotlin "val x: Int = 5"
$ Some(IrFile(None,Some(Vector(IrTopLevelObject(Some(IrDeclaration(Some(IrProperty(Some(x),Some(5),Some(Int))),None)))))))