Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 2.33 KB

README.md

File metadata and controls

47 lines (34 loc) · 2.33 KB

Sigi Frontend

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.

Requirements

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

Summary of development commands

  • just test: build the project and run tests
  • just build (or just 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 the sigi-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 of sigiToMlir.
  • 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.