Slide 1

Slide 1 text

Roslyn – (awesome) open source C# compiler Toni Petrina Ekobit d.o.o. @to_pe [email protected]

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Agenda • Introduction • Awesome things • Awesome thing 1 • Awesome thing 2 • Awesome thing 3 • ... • Conclusion

Slide 4

Slide 4 text

What is Roslyn?

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

What is a compiler? • A black box • „It does stuff” • It works „Black box” Source code Assets Binary output

Slide 8

Slide 8 text

What is it good for • Parsing • Validating • Semantics • Code rejection

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

A thing: Roslyn compiler

Slide 11

Slide 11 text

Adding (or removing) language features • Create your own C#++ • Additional language constructs • Improve existing ones • Fork Roslyn first at http://roslyn.codeplex.com

Slide 12

Slide 12 text

A thing: Language features

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Basic APIs

Slide 15

Slide 15 text

Compiler APIs • Don’t depend on Visual Studio • Syntactic and semantic model for each phase • Immutable

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

A thing: Diagnostics

Slide 18

Slide 18 text

A thing: Refactoring

Slide 19

Slide 19 text

Workspace API • Code analysis • Refactorings • No dependencies on Visual Studio • Tools: • Find All References • Formatting • Code Generation APIs

Slide 20

Slide 20 text

How does it all tie together?

Slide 21

Slide 21 text

How Roslyn sees your code?

Slide 22

Slide 22 text

A thing: Refactorings

Slide 23

Slide 23 text

A thing: REPL

Slide 24

Slide 24 text

A thing: custom editor

Slide 25

Slide 25 text

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/

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

Links • http://roslyn.codeplex.com • Official Roslyn • http://github.com/mono/roslyn • Mono port

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content