This is the frontend for the Sigi language compiler (see language reference). It implements lexing, parsing, and semantic analysis like type inference. It also contains an interpreter (and REPL) to easily execute Sigi expressions.
Compilation of Sigi code to an executable is done via MLIR.
This frontend can emit MLIR code that uses the sigi
and closure
dialects of sigi-mlir
.
These dialects, along with the rest of the compilation pipeline, are defined in the sigi-mlir
repo.
Note: the sigi
dialect reference is in this repo.
Please install just to use common building commands (see the justfile).
For development you need Scala 3 and SBT. For deployment you need GraalVM's native image utility.
You can install all of these easily with sdkman. If you don't have sdkman, run
just installSdkman
Once you have installed sdkman, run
just installRequirementsWithSdkman
just test
: build the project and run testsjust build
(orjust b
): build binaries using native-image
After running just b
, the following commands are available:
just repl
: run the interactive Sigi REPL;just sigiToMlir [ - | FILE]
: execute thesigi-to-mlir
utility with given arguments (output is on stdout):just sigiToMlir -
takes input from standard input,just sigiToMlir fileName.sigi
takes input from a file,just exprToMlir "sigi code"
: convenience wrapper to compile a single Sigi expression;
just interpretFile [ - | FILE ]
: execute the interpreter on a Sigi file or standard input. This can be used to check that compiled code behaves like the interpreter. Arguments are like those ofsigiToMlir
.just interpretExpr "sigi code"
: convenience for running the interpreter on a single expression.
Those commands use the binaries built with just b
. Don't forget to run just b
to update the binaries when you make a change.
All of those can be run from within an IDE by finding the correct @main
function. This allows debugging and keeps your class files fresh.