kekyo / IL2C

IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Apache License 2.0
401 stars 36 forks source link
aot arduino c cil csharp dotnet ecma335 fsharp intermediate-language msil systems-programming translator transpiler uefi wdm

IL2C - A translator for ECMA-335 CIL/MSIL to C language.

Intermediate language everywhere!

What's this?

Simple hello-world like code

Original C# source code:

public static class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("Hello world with IL2C!");
    }
}

Translated to C source code (all comments are stripped):

IL2C_CONST_STRING(string0__, L"Hello world with IL2C!");

void HelloWorld_Main()
{
    struct
    {
        const IL2C_EXECUTION_FRAME* pNext__;
        const uint16_t objRefCount__;
        const uint16_t valueCount__;
        System_String* stack0_0__;
    } frame__ = { NULL, 1, 0 };
    il2c_link_execution_frame(&frame__);

    frame__.stack0_0__ = string0__;
    System_Console_WriteLine_10(frame__.stack0_0__);
    il2c_unlink_execution_frame(&frame__);
    return;
}

View with comments / other sample translation results (contain complex results)

Getting started

IL2C current status is experimental, read a simple "Getting started" for first step.

If you need understanding deep knowledge for IL2C, see "Inside IL2C" .

Project status

Following lists are auto-generated by unit test.

Supported features (old)

Packages

Packages master devel
IL2C.Build NuGet IL2C.Build MyGet IL2C.Build
IL2C.Interop NuGet IL2C.Interop MyGet IL2C.Interop
IL2C.Core NuGet IL2C.Core MyGet IL2C.Core
IL2C.Runtime NuGet IL2C.Runtime MyGet IL2C.Runtime
IL2C.Runtime.msvc NuGet IL2C.Runtime.msvc MyGet IL2C.Runtime.msvc
IL2C.Runtime.Arduino (Constructing) (Constructing)

Build status

Configuration master
Publish Azure pipelines (.NET 4.5 / .NET Core 2.0)
Debug Azure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
Release Azure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
Configuration devel
Publish Azure pipelines (.NET 4.5 / .NET Core 2.0)
Debug Azure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
Build Stats
Release Azure pipelines (.NET 4.5 / .NET Core 2.0) Azure pipelines tests
Build Stats

License

Under Apache v2.

Related information

Photos of design process