.NET compiler

"Felipe Angriman" <felipeangriman@gmail.com>
Tue, 16 Sep 2008 11:37:43 -0300

          From comp.compilers

Related articles
.NET compiler anders43@gmail.com (ajk) (2008-09-15)
.NET compiler felipeangriman@gmail.com (Felipe Angriman) (2008-09-16)
Re: .NET compiler sh006d3592@blueyonder.co.uk (Stephen Horne) (2008-09-16)
Re: .NET compiler ang.usenet@gmail.com (Aaron Gray) (2008-09-18)
| List of all articles for this month |

From: "Felipe Angriman" <felipeangriman@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 16 Sep 2008 11:37:43 -0300
Organization: Compilers Central
References: 08-09-070
Keywords: code, design
Posted-Date: 16 Sep 2008 11:02:47 EDT

On Mon, Sep 15, 2008 at 10:14 PM, ajk <anders43@gmail.com> wrote:
> If I was contemplating doing a .NET compiler for a language, would it
> be better to generate ILAsm or some other higher-level .NET language?

First you should consider whether your language is using a subset of the CLR
or the full CLR.

If it is a Subset of the CLR then any Language which implements a
superset of your
Language Functionality should be fine. IMO C# would be the best choice
since there are mature compilers on the Mono .NET platform
as well in the Microsoft .NET Platform.

If you intented to target the full CLR then you should generate IL.

> By creating ILAsm there is more control but I suppose one would have
> to put more effort in optimisation.

True, generating IL always gives you more control. While it is true that
you might need to do some extra effort to generate "Good" IL sequences
for yor assemblies, I would generate IL that "just works" for the moment.

Applications that are long lived are optimized by the NGen Service on the
Microsoft .NET Platform (I don't recall if there is such service on
the mono Platform)
Anyway, if you are in desperate needs for performance you can precompile
an assembly to a native image, and Let the Native Image Compiler
do the optimizations for you

> Any other benefits of doing ILAsm compared to say C# and then
> compiling C# using the std compiler?

Yes, if you generate IL you wouldn't be creating a dependency to
a software which you DON'T Control. The compiler might evolve and
introduce semantics which are different than those of your language,
although this is very unlikely.

Besides if you intend that your compiler is used in environments that you
do not control, then generating IL is almost a MUST DO

Hope it Helps,


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.