2

Currently I am developing a programming language and a compiler. I use antlr as a parser generator and I am implementing everything in C# targeting .Net Core 3.1

At the moment I am compiling my language into x86 GNU Assembler, but I have been thinking about compiling it into IL-Code as a lot of features like OO are deeply integrated into IL.

I have already found out, that there is the possibility to generate IL-Code on runtime with the System.Reflection.Emit namespace, but in .Net Core it is currently not possible to set an entry point for the DLL or to save it persistently. I did also already dig a bit deeper into the code generation of the .Net Core compiler and read about Roslyn, but it does only support generating IL-Code for C#-Code and I also don't want to dig deeper one more layer.

My Question is:

Does somebody know how to generate IL-Code and persistently save it when targeting .Net Core?

Lars Behl
  • 253
  • 2
  • 8
  • 2
    mono.cecil? https://stackoverflow.com/questions/39366963/how-to-use-mono-cecil-to-create-helloworld-exe/39369989 – canton7 Jan 02 '20 at 16:28
  • Roslyn is't a .Net compiler, it's a c# compiler that produces .Net IL. It will only compile C#. Since you're designing/implementing a custom language that targets IL, the Roslyn compiler won't be of use. Look into LLVM.Net. There are tutorials available on implementing custom languages. –  Jan 02 '20 at 16:33
  • https://github.com/dotnet/corefx/issues/4491 – Hans Passant Jan 02 '20 at 17:20
  • @Amy doesn't Roslyn also support VB.Net? – NetMage Jan 02 '20 at 20:57
  • @NetMage Ah, right you are. TIL. It also compiles VB.Net. –  Jan 02 '20 at 20:58

0 Answers0