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

22

What is the Roslyn compiler?

Is this the default Visual Studio compiler?

Is it open source? Why did they do this?

Only for C # or other languages as well?

    
asked by anonymous 26.08.2015 / 22:08

1 answer

22

Now it calls .Net Compiler Platform . It is a build platform as a service, so you have an extra-decoupled library with the various compiler features available to be called as needed. The language compiler as we know it is just one of the consumers of this platform.

It is the default compiler of C # 6 and is next to .Net 4.6, .Net Core 5 and < a href="https://en.stackoverflow.com/q/21672/101"> Visual Studio 2015 (I need to update this response). Can be used form as well. Part of it is being availed for the Monkey.

It uses MIT license and is 100% open source , freer 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 say that you did all this, that is, you can not take ownership of it, but usage 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's a "state of the art" compiler.

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

Of course you have more important goals, although the former is a veiled truth:

  • Provide infrastructure for other tools that need parse code in C # and VB.Net
    • Delete the various partial compilation services that Microsoft and third parties had in the IDE (navigation, refactoring, helpers, formatters, etc.), several frameworks (ASP. Net, EF, LINQ, etc.), code analyzers (FXCop), code generators, Semantic Diff , etc. and generate opportunities for other tools to emerge with low input barriers.
    • Allow applications to consume your services (DSLs, business rule engine, workflow, plugins, etc.)
    • Facilitate the creation of script and REPL (interpretation)
    • Officially not much is said about this but it's great to make metaprogramming and #
    • Provide a consistent API for easy access to code
  • Facilitate changes to the compiler in a safer and easier language than C ++ (original compiler language). Now you can experiment more easily (not only within Microsoft), and you can implement new features faster and at lower cost
  • Facilitate parallel code writing using TPL for make better use of the various processors available today. It was almost impossible to do this in the old code, not only because C ++ does not help so much, but also because the old compiler was poorly planned or at least not thought for it.
  • Fix the bunch of bugs they did in the original compiler and build a more robust and flexible architecture. They had the opportunity to see some aspects of the compilation process better
  • It was not an original goal but the opening allowed to receive contributions, more people checking for problems in the code
  • Have a single infrastructure to serve 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.
26.08.2015 / 22:21