- Source: Roslyn (compiler)
.NET Compiler Platform, also known by its codename Roslyn, is a set of open-source compilers and code analysis APIs for C# and Visual Basic (VB.NET) languages from Microsoft.
The project notably includes self-hosting versions of the C# and VB.NET compilers – compilers written in the languages themselves. The compilers are available via the traditional command-line programs but also as APIs available natively from within .NET code. Roslyn exposes modules for syntactic (lexical) analysis of code, semantic analysis, dynamic compilation to CIL, and code emission.
Features
Features of Roslyn include:
Compilers for the C# and Visual Basic languages exposed as services via APIs.
APIs for code analysis and refactoring.
History
The code name "Roslyn" was first written by Eric Lippert (a former Microsoft engineer) in a post that he published in 2010 to hire developers for a new project. He first said that the origin of the name was because of Roslyn, Washington, but later in the post he speaks ironically about the "northern exposure" of its office; the city of Roslyn was one of the places where the television series Northern Exposure was filmed.
Microsoft made a community technology preview (CTP) available for public download in October 2011. It installed as an extension to Visual Studio 2010 SP1.
The CTP was updated in September 2012 to include many updates to the Roslyn APIs introduced in the June 2012 and October 2011 CTPs, including breaking changes. While the June 2012 CTP API is complete for the compilers, not all features were implemented for the C# and VB.NET languages.
At the Build 2014 conference in San Francisco April 2014, Microsoft made the "Roslyn" project open-source and released a preview of the language integration for Visual Studio 2013. As of April 3, 2014, Roslyn is under the Apache License 2.0. The project was effectively transferred under the stewardship of the newly founded .NET Foundation. At the same conference, Xamarin announced that they are working on integrating the new compilers and tools in Xamarin Studio.
The compilers were not feature-complete in this release. Each of the compilers contains features that are planned for the coming language versions (C# 6 and Visual Basic.NET 14). The APIs are also available through the NuGet package manager.
As of 2013, Roslyn supports VB and C#, and the compilers are written in their respective languages. Roslyn's first release to manufacturing (RTM) was with Visual Studio 2015.
In January 2015, Microsoft moved the Roslyn source code from CodePlex to GitHub.
Architecture
Traditionally .NET compilers have been a black box for application developers. With increasing complexity and demands for source code analysis in modern integrated development environments, however, compilers need to expose application programming interfaces (APIs) that will help developers to directly perform phases of compilation such as lexical and syntactic structure analysis of source code. Roslyn was designed with that intent from the beginning. This reduces the barrier in developing tools specifically designed for source code analysis. APIs of Roslyn are of three types: feature APIs, work-space APIs and compiler APIs. Feature APIs allow source code tool developers to do code refactoring and fixes. Work-space APIs allow plugin developers to perform actions specifically required in integrated development environments (IDEs) like Visual Studio such as finding references of a variable or code formatting. Compiler APIs allow even more sophisticated analysis of source code, by exposing direct calls to perform syntax tree and binding flow analysis. Using an open-source implementation of Common Language Infrastructure (CLI) such as .NET Core, Roslyn will be able to compile in a platform-agnostic manner capable of running CLI code in Linux, OS X, and Windows.
See also
List of compilers
Microsoft Phoenix
References
Further reading
Vasani, Manish (2017). Roslyn Cookbook: Compiler as a Service, Code Analysis, Code Quality and more. Packt Publishing. ISBN 978-1787286832.
Harrison, Nick (2017). Code Generation with Roslyn. Apress. ISBN 978-1484222102.
Mukherjee, Sudipta (2017). Source Code Analytics With Roslyn and JavaScript Data Visualization. Apress. ISBN 978-1484219249.
External links
Official website
Introducing the Microsoft “Roslyn” CTP on the C# Frequently Asked Questions MSDN blog
Throwing the Big Switch on Roslyn on the C# Frequently Asked Questions MSDN blog
Kata Kunci Pencarian:
- C Sharp (bahasa pemrograman)
- Roslyn (compiler)
- Roslyn
- PeachPie
- List of compilers
- C Sharp (programming language)
- Visual Basic (.NET)
- Self-hosting (compilers)
- Bartok (compiler)
- Phalanger (compiler)
- DBase