project roslyn - icse conference s2013.icse-conferences.org/documents/publicity/topi-ws...project...
TRANSCRIPT
Project RoslynExposing the C# and Visual Basic compilers’ code analysis
Dustin CampbellSenior Program ManagerMicrosoft
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
Syntax Tree API Symbol APIBinding and Flow Analysis
APIsEmit APIParser
Metadata Import
Binder IL Emitter
Symbols
Language Service
Compiler API
Compiler Pipeline
Form
atter
Co
lorizer
Ou
tlinin
g
Navigate To
Ob
ject Bro
wser
Co
mp
letion
List
Find
All
Referen
ces
Ren
ame
Qu
ick Info
Signatu
re Help
Extract Meth
od
Go
To D
efinitio
n
Edit an
d C
on
tinu
e
Design Choices
Resilient
Immutable Complete
Efficient
Demo: Compiler APIs
Major PlayersSyntax Nodes
class C{
void M(){}
}// C▫
CompilationUnit
TypeDeclaration
MethodDeclaration
ParameterList Block
SyntaxTreeGetRoot
Major PlayersSyntax Tokens
class C{
void M(){}
}// C▫
CompilationUnit
TypeDeclaration
MethodDeclaration
ParameterList Block
SyntaxTreeGetRoot
EOF
class C { }
void M
( ) { }
Major PlayersSyntax Tokens
EOF
class C
{
}
void M ( )
{
}
class∙C{∙∙∙∙void∙M()∙∙∙∙{∙∙∙∙}}// C▫
Major PlayersSyntax “Trivia”
EOF
class C
{
}
void M ( )
{
}
SP EOL
EOL
EOL
EOL
EOL
EOL
class∙C{∙∙∙∙void∙M()∙∙∙∙{∙∙∙∙}}// C▫
// C
SPx4
SPx4
SPx4
SP
SyntaxTrees
References
Compilation• Symbols
• Diagnostics
• Emit
Major PlayersCompilations, References and Symbols
Major PlayersSemantics
Compilation
SemanticModel
• Binding Information
• Conversion Classification
• Flow Analysis
• Overload Resolution
• Etc.
GetSemanticModel(tree)
Major PlayersWorkspace, Solutions, Projects and Documents
Apply
Edit Edit
SyntaxTree
Compilation
Events (e.g. key presses)
Demo: Building a Quick Fix
• 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:[email protected]