mina is a minimum viable functional programming language for the JVM.
Everything is currently under construction and subject to change.
The project is a multi-module Gradle project, making use of shared convention plugins in buildSrc/
.
The project structure is as follows:
buildSrc/
- this contains shared Gradle build definitionscompiler
- this subfolder contains subprojects that implement the compiler phases.compiler/common
- this contains shared data structures that are used by all compiler phases. Many of these definitions exactly mirror those from the Language Server Protocol. Mina is designed to integrate with LSP, but we don't want to depend on the Java LSP4J library throughout the compiler.compiler/syntax
- this contains the definition of the abstract syntax tree and utilities for working with trees.compiler/parser
- this contains the ANTLR grammar of the language and the batch-mode parsing phase for namespace definitions.compiler/renamer
- this contains the name resolution phase, which is responsible for resolving imports and attributing syntax trees with fully qualified names.compiler/typechecker
- this contains the phase responsible for kind-checking data types and type-checking let bindings.compiler/intermediate
- unimplemented; this will contain the intermediate language for the compiler optimisation phases.compiler/jvm
- this contains the JVM bytecode generation phase for the compiler, currently only implemented for unoptimised syntax trees.compiler/main
- this contains the compiler driver which is responsible for orchestrating compilation of source files.compiler/cli
- this contains the command line interface to the Mina compiler,minac
.
examples
- this contains examples of the Mina language syntax.gradle/libs.versions.toml
- this is the version catalog declaring dependencies and their versions. See the Gradle documentation about The version catalog TOML file format for more details.gradle-plugin
- this contains a Gradle plugin for declaring and building Mina projects. At present it only provides tasks for compiling Mina code.lang-server
- this contains an LSP-compatible language server implemented using lsp4j. This server currently implements text document synchronisation and build server connectivity using the Build Server Protocol, but otherwise its functionality is extremely limited.proto
- unimplemented, currently nothing more than a copy of the Protobuf definitions from DavidGregory084/inc. This will contain Protobuf definitions for the language syntax and intermediate language. The AST of each namespace will be embedded in its Mina .class file as a custom class file attribute. The optimised intermediate language for definitions will be embedded in Mina .class files for the purposes of inlining. They will serve a similar purpose to Haskell .hi files.vscode-plugin
- the VS Code plugin which interacts with the language server inlang-server
.
Prerequisites:
- JDK 17+
- Node 18+
To get started:
- Build the entire project using
./gradlew build publish publishToMavenLocal --info
. This also builds the VS Code plugin using gradle-node-plugin and publishes the project artifacts to the local Ivy and Maven repositories so that they can be resolved for use by the VS Code plugin and Gradle plugin. - Open the VS Code extension file in VS Code and hit F5 to launch the Extension Development Host. Try opening the
examples/
folder from this project. You can examine the language and build server logging in the "Mina Language Server" window of the VS Code Output tab.
I think it would be wise to set expectations around contributing to this project: at present it's very much incomplete, amorphous, incubating, and all of the other things that mean a broken and unfinished work in progress, and I have fairly strong opinions about what I would like to achieve.
It would likely be better to wait until the project has solidified a bit and is closer to completion if you'd like to contribute code.
Having said that, I would welcome discussions about the proposed language syntax, project structure, the name of the project, planned features, suggestions, and anything else you'd like to talk about.
All code in this repository is licensed under the Apache License, Version 2.0. See LICENSE.