This will eventually be a Ballerina compiler, written in Ballerina, which uses LLVM to generate native executables.
The compiler is divided into the following Ballerina packages:
driver
- this coordinates the other packages to perform the compilationbir
- this defines a Ballerina-specific intermediate representation (BIR) of Ballerina programsfront
- this turns Ballerina source code into BIRllvm
- this generates LLVM IR from BIRtypes
- this defines a normalized representation of Ballerina's types, and associated operations such as subtype testing and intersection
The dependencies are as follows:
bir
depends ontypes
(BIR is typed using the normalized types provided bytypes
)llvm
depends onbir
andtypes
(but notfront
)front
depends onbir
andtypes
(but not `llvm)driver
depends on everything
So far, the only implemented functionality relates to types:
-
the
front
module can parse a module containing Ballerina type definitions in this subset of Ballerina syntax; -
the
front
module can use thetypes
module to build a normalized representation; -
the
types
module can determine whether one type is a semantic subtype of another (more information on this); -
the
driver
module allows you to play with this: it will print out the subtype relationships between all named types in a Ballerina module; the directory driver/tests/data has some examples you can try out.