Re: [Mono-dev] ilasm as a library

2010-05-17 Thread Miguel Garcia

Andreas Nahr classdevelopm...@a-softtech.com wrote in message 
news:002b01caf54b$a49d3940$edd7ab...@com...
 Which use case do you see for a temporary solution using .il files?

The compiler backend in question currently generates .il but no .dll or .exe 
files. That's why I was thinking about calling Mono ilasm as a library 
(requiring no restart across invocations, which would require Mono ilasm to 
avoid static state) .

Now that you mention System.Reflection,
https://blogs.msdn.com/jmstall/archive/2008/03/15/things-in-metadata-that-are-missing-in-reflection.aspx
http://weblog.ikvm.net/PermaLink.aspx?guid=9b7ada92-88d7-45c7-be83-8e6f4f3ccb1b
Not everyone uses System.Reflection. The list goes on.

Miguel



___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-17 Thread Andreas Nahr
 Now that you mention System.Reflection,

I'm not sure how you get to that statement. But I NEVER mentioned
System.Reflection. I've been talking about System.Reflection.Emit which is
an (entirely) different thing.

 https://blogs.msdn.com/jmstall/archive/2008/03/15/things-in-metadata-
 that-are-missing-in-reflection.aspx

And what does this have to do with System.Reflection.Emit?

 http://weblog.ikvm.net/PermaLink.aspx?guid=9b7ada92-88d7-45c7-be83-
 8e6f4f3ccb1b

That's a cool source-compatible replacement for System.Reflection.Emit. So
you can develop against System.Reflection.Emit and simply drop
IKVM.Reflection.Emit in to replace it (or vice versa).

 Not everyone uses System.Reflection. The list goes on.

No, not *everyone* does. But nearly everyone does it.

Andreas

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] ilasm as a library

2010-05-16 Thread Miguel Garcia

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). 

I started exploring codegen.cs and found a reference to 
Mono.CompilerServices.SymbolWriter . That may save an intermediate 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?) 

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

Miguel 


[1] http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded

[2] http://anonsvn.mono-project.com/viewvc/trunk/mcs/ilasm/ 


-- 
Miguel Garcia   
Swiss Federal Institute of Technology
EPFL - IC - LAMP1 - INR 328 - Station 14
CH-1015 Lausanne - Switzerland
http://lamp.epfl.ch/~magarcia/___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Robert Jordan
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

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Miguel Garcia

Robert,

Actually I did not mention IKVM.Reflection.Emit, nor Mono Cecil (old and 
new), and so on because for now I'm after a temporary solution, in the form 
of in-memory IL compilation (none of the CIL-emit libraries address this use 
case).

Given that Microsoft's ilasm can only be invoked as a command-line tool, it 
would be great if Mono ilasm would sport a homepage showing off this 
capability (I for one would find a code example or two very useful).

What kind of programming language is Scala? It's THE post-functional 
programming language! ;-) Details here: http://www.scala-lang.org/node/4960

About  JayC, I made some more browsing and found this 
http://code.google.com/p/jayc/ , which I guess is the version gmcs uses, 
right? (otherwise, the correct URL would be welcome).


regards,

Miguel


Robert Jordan robe...@gmx.net wrote in message 
news:hsotti$2o...@dough.gmane.org...
 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 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Rodrigo Kumpera
I tried that in the past, to programatically call ilasm. The issue was that
the library has some static context
so it can't be called multiple times. I tried to hack around using
appdomains with no luck at all.

Changing it to work as a library should be easy (just peek at Driver::Main
for how to do it). The main core issue
is fixing the issue I mentioned. I have no idea how hard to fix it because I
didn't put much more than an hours
looking into it.


On Sun, May 16, 2010 at 10:22 AM, Miguel Garcia miguel.gar...@tuhh.dewrote:


 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).

 I started exploring codegen.cs and found a reference to
 Mono.CompilerServices.SymbolWriter . That may save an intermediate 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?)

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

 Miguel


 [1] http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded

 [2] http://anonsvn.mono-project.com/viewvc/trunk/mcs/ilasm/


 --
 Miguel Garcia
 Swiss Federal Institute of Technology
 EPFL - IC - LAMP1 - INR 328 - Station 14
 CH-1015 Lausanne - Switzerland
 http://lamp.epfl.ch/~magarcia/

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Rodrigo Kumpera
Forgot to mention, my problem with using appdomain was the very lacking
performance.

On Sun, May 16, 2010 at 12:35 PM, Rodrigo Kumpera kump...@gmail.com wrote:

 I tried that in the past, to programatically call ilasm. The issue was that
 the library has some static context
 so it can't be called multiple times. I tried to hack around using
 appdomains with no luck at all.

 Changing it to work as a library should be easy (just peek at Driver::Main
 for how to do it). The main core issue
 is fixing the issue I mentioned. I have no idea how hard to fix it because
 I didn't put much more than an hours
 looking into it.


 On Sun, May 16, 2010 at 10:22 AM, Miguel Garcia miguel.gar...@tuhh.dewrote:


 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).

 I started exploring codegen.cs and found a reference to
 Mono.CompilerServices.SymbolWriter . That may save an intermediate 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?)

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

 Miguel


 [1] http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded

 [2] http://anonsvn.mono-project.com/viewvc/trunk/mcs/ilasm/


 --
 Miguel Garcia
 Swiss Federal Institute of Technology
 EPFL - IC - LAMP1 - INR 328 - Station 14
 CH-1015 Lausanne - Switzerland
 http://lamp.epfl.ch/~magarcia/

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list



___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Robert Jordan
Miguel,

On 16.05.2010 17:12, Miguel Garcia wrote:
 Given that Microsoft's ilasm can only be invoked as a command-line tool, it
 would be great if Mono ilasm would sport a homepage showing off this
 capability (I for one would find a code example or two very useful).

It doesn't support in-memory parsing, but it shouldn't be too hard
to implement this functionality [see Rodrigo's answer].

 What kind of programming language is Scala? It's THE post-functional
 programming language! ;-) Details here: http://www.scala-lang.org/node/4960

Oops, I'm obviously a functional ignorant :)

 About  JayC, I made some more browsing and found this
 http://code.google.com/p/jayc/ , which I guess is the version gmcs uses,
 right? (otherwise, the correct URL would be welcome).

http://anonsvn.mono-project.com/viewvc/trunk/mcs/jay/

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ilasm as a library

2010-05-16 Thread Robert Jordan
On 16.05.2010 17:48, Robert Jordan wrote:
 About  JayC, I made some more browsing and found this
 http://code.google.com/p/jayc/ , which I guess is the version gmcs uses,
 right? (otherwise, the correct URL would be welcome).

 http://anonsvn.mono-project.com/viewvc/trunk/mcs/jay/

What I forgot to mention: this is the version that emits C# code,
but this still doesn't mean that the input parser is tied to C#.

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list