Project Roslyn Exposing the C# and Visual Basic compilers code - - PowerPoint PPT Presentation

project roslyn
SMART_READER_LITE
LIVE PREVIEW

Project Roslyn Exposing the C# and Visual Basic compilers code - - PowerPoint PPT Presentation

Project Roslyn Exposing the C# and Visual Basic compilers code analysis Dustin Campbell Senior Program Manager Microsoft Project Codename Roslyn Scope Managed compilers & language services Code analysis APIs


slide-1
SLIDE 1

Project Roslyn

Exposing the C# and Visual Basic compilers’ code analysis

Dustin Campbell Senior Program Manager Microsoft

slide-2
SLIDE 2

Project Codename “Roslyn”

  • Scope
  • Managed compilers & language services
  • Code analysis APIs
  • Scripting APIs
  • Language service extensibility
  • Read-Eval-Print-Loop (REPL)
  • Ship Date
  • v.Next + n, where n > 0
slide-3
SLIDE 3

Syntax Tree API Symbol API Binding and Flow Analysis APIs Emit API Parser

Metadata Import

Binder IL Emitter Symbols

Language Service Compiler API Compiler Pipeline

Formatter Colorizer Outlining Navigate To Object Browser Completion List Find All References Rename Quick Info Signature Help Extract Method Go To Definition Edit and Continue

slide-4
SLIDE 4

Design Choices

Resilient Immutable Complete Efficient

slide-5
SLIDE 5

Demo: Compiler APIs

slide-6
SLIDE 6

Major Players

Syntax Nodes

class C { void M() { } }// C ▫

CompilationUnit TypeDeclaration MethodDeclaration ParameterList Block

SyntaxTree GetRoot

slide-7
SLIDE 7

Major Players

Syntax Tokens

class C { void M() { } }// C ▫

CompilationUnit TypeDeclaration MethodDeclaration ParameterList Block

SyntaxTree GetRoot

EOF class C { } void M ( ) { }

slide-8
SLIDE 8

Major Players

Syntax Tokens

EOF class C { } void M ( ) { }

class∙C { ∙∙∙∙void∙M() ∙∙∙∙{ ∙∙∙∙} }// C ▫

slide-9
SLIDE 9

Major Players

Syntax “Trivia”

EOF class C { } void M ( ) { } SP EOL EOL EOL EOL EOL EOL

class∙C { ∙∙∙∙void∙M() ∙∙∙∙{ ∙∙∙∙} }// C ▫

// C SPx4 SPx4 SPx4 SP

slide-10
SLIDE 10

SyntaxTrees References

Compilation

  • Symbols
  • Diagnostics
  • Emit

Major Players

Compilations, References and Symbols

slide-11
SLIDE 11

Major Players

Semantics

Compilation

SemanticModel

  • Binding Information
  • Conversion Classification
  • Flow Analysis
  • Overload Resolution
  • Etc.

GetSemanticModel(tree)

slide-12
SLIDE 12

Major Players

Workspace, Solutions, Projects and Documents

Apply Edit Edit SyntaxTree Compilation Events (e.g. key presses)

slide-13
SLIDE 13

Demo: Building a Quick Fix

slide-14
SLIDE 14
  • Install the Roslyn CTP
  • Try out the APIs
  • Give us feedback!

Next Steps

Dev Center: http://msdn.com/roslyn Forum: http://social.msdn.microsoft.com/forums/en-us/roslyn Email: dustinca@microsoft.com