il2c - IL2C.Core 0.4.377

A translator implementation of .NET intermediate language to C language.

PM> Install-Package IL2C.Core -Version 0.4.377 -Source https://www.myget.org/F/il2c/api/v3/index.json

Copy to clipboard

> nuget.exe install IL2C.Core -Version 0.4.377 -Source https://www.myget.org/F/il2c/api/v3/index.json

Copy to clipboard

> dotnet add package IL2C.Core --version 0.4.377 --source https://www.myget.org/F/il2c/api/v3/index.json

Copy to clipboard
<PackageReference Include="IL2C.Core" Version="0.4.377" />
Copy to clipboard
source https://www.myget.org/F/il2c/api/v3/index.json

nuget IL2C.Core  ~> 0.4.377
Copy to clipboard

> choco install IL2C.Core --version 0.4.377 --source https://www.myget.org/F/il2c/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "il2c" -SourceLocation "https://www.myget.org/F/il2c/api/v2"
Install-Module -Name "IL2C.Core" -RequiredVersion "0.4.377" -Repository "il2c" 
Copy to clipboard

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

Intermediate language everywhere!

What's this?

  • IL2C is a translator (transpiler) of ECMA-335 CIL/MSIL to C language.

  • We're aiming for:

    • Better predictability of runtime costs
      Better human readability of C source code translated by IL2C.
    • Very tiny footprint requirements
      We're thinking about how to fit from large system with many resources to tiny embedded system. (KB order for the non-OSes system)
    • Better code/runtime portability
      Minimum requirement is only C99 compiler. The runtime minimum requires only the heap, CAS instructions, (POSIX) signal and setjmp/longjmp. Additional better feature is threading API (Win32, pthreads and FreeRTOS.)
    • Better interoperabilities for existed C libraries
      You can use the standard .NET interop technics (like P/Invoke.)
    • Containing seamless building systems for major C toolkits
      for example: CMake system, Arduino IDE, VC++ ...

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

  • #6-6: Near milestones

    #6-6: Near milestones

  • #6-14: Data flow analysis

    #6-14: Data flow analysis

  • Milestone 1: Test on VC++ and check how C compiler's optimizer works.

    Milestone 1: Test on VC++ and check how C compiler's optimizer works

  • #6-48: How mark-and-sweep garbage collection works on a translated code.

    #6-48: How mark-and-sweep garbage collection works on a translated code

  • How overload/override/virtual method symbol calculus work.

    How overload/override/virtual method symbol calculus work

  • How to translate exception handlers when combined the local unwind and global unwind.

    How to translate exception handlers when combined the local unwind and global unwind

  • This is the strcuture graph for the exection-frame and exception-frame.

    This is the strcuture graph for the exection-frame and exception-frame

Merge branch 'feature/testcase-enhancement' into devel

  • .NETFramework 4.6.2
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETFramework 4.8
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 2.0
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 2.1
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 2.2
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 3.0
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 3.1
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETFramework 5.0
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETFramework 6.0
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETStandard 2.0
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETStandard 2.1
    • Mono.Cecil (>= 0.11.4)
    • System.Threading.Tasks.Extensions (>= 4.5.4)
    • System.ValueTuple (>= 4.5.0)
  • .NETCoreApp 2.0: 2.0.0.0
  • .NETCoreApp 2.1: 2.1.0.0
  • .NETCoreApp 2.2: 2.2.0.0
  • .NETCoreApp 3.0: 3.0.0.0
  • .NETCoreApp 3.1: 3.1.0.0
  • .NETFramework 4.6.2: 4.6.2.0
  • .NETFramework 4.8: 4.8.0.0
  • .NETFramework 5.0: 5.0.0.0
  • .NETFramework 6.0: 6.0.0.0
  • .NETStandard 2.0: 2.0.0.0
  • .NETStandard 2.1: 2.1.0.0

Owners

Kouji Matsui

Authors

Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)

Project URL

https://github.com/kekyo/IL2C.git

License

Unknown

Tags

il2c cil msil translate transpile aot ecma335 c c++ win32 uefi wdm multi-platform systems-programming

Info

11 total downloads
3 downloads for version 0.4.377
Download (1.64 MB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.4.377 1.64 MB Sun, 12 Jun 2022 11:07:31 GMT 3
0.4.375 1.64 MB Sun, 12 Jun 2022 10:32:49 GMT 3
0.4.230 1.16 MB Wed, 11 May 2022 00:22:52 GMT 2
0.4.70-74e1874d02 798.03 KB Sat, 18 May 2019 11:22:16 GMT 3