[Mono-dev] ilasm as a library

Robert Jordan robertj at gmx.net
Sun May 16 10:02:25 EDT 2010


On 16.05.2010 15:22, Miguel Garcia wrote:
>
> Hi,
>
> I wanted to see how gmcs generates assemblies, given that I want to
> do the same for the Scala.Net compiler [1] (which as of now generates
> .il files).

It is using System.Reflection.Emit, which means that there is
no intermediate IL source code generation involved.

> I started exploring codegen.cs and found a reference to
> Mono.CompilerServices.SymbolWriter . That may save an intermediate

The SymbolWriter is used to emit debugging infos. It's not a code
generator.

> step, but how about programmatically invoking the Mono IL Assembler
> [2] passing an in-memory .il file as input? (and BTW, can Jay
> generate C#-only parsers?)

Jay, as a LALR(1) parser generator, is not limited to C# at all.

> A code snippet on how to use Mono's ilasm as a component would be
> most welcome!

In the .NET ecosystem, compilers usually don't go down the
route of generating IL *source code*. Look at System.Reflection.Emit,
IKVM.Reflection.Emit, DLR depending on which kind of language
Scala is (I have no idea).

Robert



More information about the Mono-devel-list mailing list