Table of Contents

Compiler API

The Dassie.Compiler project contains a simple API for interacting with the Dassie compiler from .NET applications. Below is a simple example on how to use it, a more thorough documentation will follow later. For API documentation, visit this page.

using Dassie.Compiler;
using Dassie.Configuration;

DassieConfig config = new()
{
    AssemblyName = "demo"
};

string source = """
    import System
    Console.WriteLine "Hello World!"
    """;

CompilationContext ctx = CompilationContextBuilder.CreateBuilder()
    .WithConfiguration(config)
    .AddSourceFromText(source, "main.ds")
    .Build();

CompilationResult result = ctx.Compile();