Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Roslyn – (awesome) open source C# compiler

Roslyn – (awesome) open source C# compiler

Introduction to the new open source C# compiler and features.

Avatar for Toni Petrina

Toni Petrina

May 10, 2014
Tweet

Other Decks in Programming

Transcript

  1. Agenda • Introduction • Awesome things • Awesome thing 1

    • Awesome thing 2 • Awesome thing 3 • ... • Conclusion
  2. Core .NET Next gen JIT (“RyuJIT”) SIMD Runtime Compilers .NET

    Compiler Platform (“Roslyn”) Languages innovation Windows Desktop Azure and Windows Server Universal projects .NET Native ASP.NET updates Windows Convergence Native compilation Cross-devices Xamarin partnership Web apps .NET support for Azure Mobile Services Cloud Services Openness Windows Store iOS and Android .NET in devices and services
  3. Core .NET Next gen JIT (“RyuJIT”) SIMD Runtime Compilers .NET

    Compiler Platform (“Roslyn”) Languages innovation Windows Desktop Azure and Windows Server Universal projects .NET Native ASP.NET updates Windows Convergence Native compilation Cross-devices Xamarin partnership Web apps .NET support for Azure Mobile Services Cloud Services Openness Windows Store iOS and Android .NET in devices and services
  4. What is a compiler? • A black box • „It

    does stuff” • It works „Black box” Source code Assets Binary output
  5. Reimagining of the C# and VB.NET compilers • Managed code

    this time • Turn into API • Compiler as a Service • Building blocks for the IDE, tools • Open source (Apache v2) • http://roslyn.codeplex.com
  6. Adding (or removing) language features • Create your own C#++

    • Additional language constructs • Improve existing ones • Fork Roslyn first at http://roslyn.codeplex.com
  7. Danger • Don’t do this for your project/company • Bad

    for C# culture • Can create DSL variants which you have to learn for particular company
  8. Compiler APIs • Don’t depend on Visual Studio • Syntactic

    and semantic model for each phase • Immutable
  9. Also part of the same API • Diagnostic APIs •

    UI optional • Integrates with other tools (MSBuild, FxCop, StyleCop, etc) • Can be integrated into IDE to give red squiggles or to stop build • Scripting APIs • REPL • Currently MIA • Will return in the future • Not part of the .NET Compiler Platform at the moment
  10. Workspace API • Code analysis • Refactorings • No dependencies

    on Visual Studio • Tools: • Find All References • Formatting • Code Generation APIs
  11. Honorable mentinos • Scriptcs - http://scriptcs.net/ • Reference Source: •

    .NET - http://referencesource.microsoft.com/ • Roslyn: http://source.roslyn.codeplex.com/ • Ref12 – jump from source to reference source • Extension: http://visualstudiogallery.msdn.microsoft.com/f89b27c5- 7d7b-4059-adde-7ccc709fa86e • Source code: https://github.com/SLaks/Ref12 • C# Pad – execute C# code online • http://csharppad.com/
  12. Who is it for, actually? • Developers • Integrate Roslyn

    into your own flow • Partners • Create, share and sell extensions and tools • Visual Studio team • Visual Studio experience • Everyone, really • Open source