Roslyn Compiler - What is it, and why was it created?

Asked

Viewed 2,966 times

24

What is the Roslyn compiler?

This is the standard compiler of Visual Studio?

Is it open source? Why did they do it?

Only for C# or other languages?

  • 4

    http://answall.com/q/40671

  • 3

    I did not understand the negatives, the question is pertinent. There is nothing in Portuguese easy to find, consolidated, verified by good professionals experts on the subject. I saw no lack of research, I saw usefulness, it is clear. The most that has several questions interconnected. But I think it’s better that way than asking five separate questions. Deep down, it’s one with only.

  • 1

    +1. I also want to know what is the Compiler Roslyn. And being part of the community I can contemplate the question :)

1 answer

26


Now he calls .NET Compiler Platform. It’s a build-as-a-service platform, so you have an extremely uncoupled library with the various compiler features available to call as needed. The language compiler as we know it is only one of the consumers of this platform.

It is the default compiler of C# 6 and is next to (deceased) .NET 4.x , .NET Core and Visual Studio 2015 and later. Part of it was being harnessed for Mono (which for all purposes died).

Use MIT license and it’s 100% open source, more free than GPL. It is written in C#. Much of the VB.NET compiler is written in VB.NET.

You can do whatever you want with the code except to say that it was you who did all this, that is, you cannot take ownership of it, but the use is released for any situation.

It is used for C# and VB.NET. Only. But its infrastructure can be used to facilitate the work of other languages. It is a compiler "state of the art".

It was created to prove that C# is a great language and can do anything with great performance :)

Of course it has more important objectives, although the previous one is a veiled truth:

  • Provide infrastructure for other tools that need parse code in C# and VB.NET.
  • Delete the various partial build services that Microsoft and third parties had in the IDE (browsing, Refactoring, helpers, formatters, etc.), various frameworks (ASP.NET, EF, LINQ, etc.), code analysers (Fxcop), code generators, Semantic Diff, etc. and generate opportunities for other tools to emerge with low entry barrier.
  • Allow applications to consume their services (Dsls, business Rule engine, workflow, plugins, etc..).
  • facilitate the establishment of script and REPL (interpretation).
  • Officially there is not much talk about it but it is great to facilitate the metaprogramming and the aspect-oriented programming.
  • Provide a consistent API for easy code access.
  • Facilitate compiler changes in a safer and easier language than C++ (original compiler language). Now you can experiment more easily (not just within Microsoft), and you can implement new features faster and at a lower cost.
  • Facilitate parallel code writing using the TPL to make the most of today’s various processors. It was almost impossible to do this in the old code, not only by C++ not helping so much, but also because the old compiler was poorly planned or at least not thought for it.
  • Fix the bug stack they made in the original compiler and assemble a more robust and flexible architecture. They had the opportunity to better see certain aspects of the compilation process.
  • It was not original objective but the opening allowed to receive contributions, more people checking problems in the code.
  • Have a single infrastructure to meet more than one language that has almost the same semantics. So the changes made to C# are free or very cheap to implement in VB.NET and vice versa.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.