Roslyn compiler as a service

Preview:

Citation preview

revealed by / Eugene Zharkov @2j2e

COMPILER IS A BLACK BOX

ROSLYN TEAMAnders Hejlsberg - father of Microsoft's C# language.

Matt Warren - software achitect at Microsoft on the C#programming language product team.

Pete Golde - lead developer of the original Microsoft C#compiler.

Karen Ng - lead program manager on the Visual StudioProfessional team.

FEATURESManaged compilers (C# / VB)Code analysis APIsLanguage service extensibilityRead-Eval-Print-Loop (REPL)

COMPILER PIPELINE

COMPILER API

LANGUAGE SERVICE

SYNTAX TREESImmutableResilientEfficientComplete & Consistent

SYNTAX TREE CODE EXAMPLEclass C{ void M() { } // C}

SYNTAX TREE - NODES

SYNTAX TREE CODE EXAMPLEclass C{ void M() { } // C}

SYNTAX TREE - TOKENS

SYNTAX TREE CODE EXAMPLEclass C{ void M() { } // C}

SYNTAX TREE - "TRIVIA"

SYNTAX TREE CODE EXAMPLEclass C{ void M() { } // C}

SYNTAX VISUALIZER

WORKSPACES

EXAMPLEProjectId pid1, pid2;DocumentId did1, did2;ISolution solution = Solution.Create(SolutionId.CreateNewId("Solution")) .AddCSharpProject("Project1.dll", "Project1", out pid1) .AddDocument(pid1, "A.cs", "public class A { }", out did1) .AddCSharpProject("Project2.dll", "Project2", out pid2) .AddDocument(pid2, "B.cs", "class B : A { }", out did2) .AddProjectReference(pid2, pid1);

DEMO

FOR REVIEWRoslyn documentation - http://bit.ly/roslyndocsRefactoring with Roslyn Circus Comes to TownBUILD: Anders – Future of C# and Visual BasicMeet the Design Team

THANK YOU!

source -

@2j2e

eu.zharkov@gmail.com

http://github.com/2j2e

http://bit.ly/rolsynbasics

Recommended