SlideShare a Scribd company logo
1 of 24
.NET compiler platform
Roslyn
Piotr Benetkiewicz
ais.pl
Agenda
● Introduction, background, history
● Roslyn in new VS 2015
● Syntax API
● Semantics
● Compilation
● Analyzers, Fixes
● Scripting
When, what, why
● .NET compiler platform
● Compiler as a service, csc.exe API
● Started 2008 (PDC, Los Angeles, CA)
● Codeplex -> Github
● Now in beta RC on nuget
● VS 2015
What, when, why cont.
● “Poor” csc architecture
o Different compiler forks for different tasks
o clear C# and VB separation
● C++ vs. .NET languages
Have you ever tried cat food?
What, when, why cont.
Roslyn must
● Have great throughput
● Be error insensitive
● Have great sense of error scope
● Support REPL-like scenarios
● be VS-agnostic
Getting started
● VS 2015 CTP6
o watch out for side-by-side installation!
● VS SDK
● Install-Package Microsoft.CodeAnalysis -Pre
● Optional:
o .NET Compiler Platform SDK Templates
o Syntax Visualizer extension
DEMO
Syntax
Syntax cont.
● SyntaxTree - base abstraction, immutable
● Building ST
o from source
o using factory methods
● Navigating ST
o Members and casting
o OfType<>
o CSharpSyntaxWalker
DEMO
Syntax modules are smart
Syntax modules are smart
Semantics
Yesterday a parrot will drive a bitter,
encrypted car.
● english words
● punctuation
● yet it doesn’t make sense…
● binding
Semantics cont.
● Get the real meaning of the abstract content
● Linking to a Symbol
● Needs context:
o user defined (your code!)
o external metadata (ex. mscorlib)
● Reflection on steroids (not at runtime)
o GetSymbolInfo(), GetEnclosingSymbol()
o Control flow analysis
o Can be speculative
Semantics is smart too!
“Property is inaccessible due to its protection level”
● GetSpeculativeSymbolInfo()
● ISymbolInfo.CandidateSymbols
DEMO
Analyzers, code fixes
● VS project templates
● Derive from DiagnosticAnalyzer and apply
DiagnosticAnalyzer attribute
● Derive from CodeFixProvider and apply
ExportCodeFixProvider attribute
● Use “Add analyzer” in VS, nuget or csc.exe
Analyzers, code fixes cont.
DEMO
What to expect after Roslyn ships?
● Better vanilla VS user experience
● Alternative IDEs Editors (OmniSharp)
● Even richer toolset (CI, metrics, diagnostics)
● Scripting (sciptcs)
● Exciting community and commercial projects
o code mutation
o ConfigR
Thank you
● @pbenetkiewicz
● http://benetkiewicz.github.io/blog/
● pbenetkiewicz@gmail.com, piotr@ais.pl

More Related Content

What's hot

What's hot (19)

TDC2016SP - Groovy como você nunca viu
TDC2016SP - Groovy como você nunca viuTDC2016SP - Groovy como você nunca viu
TDC2016SP - Groovy como você nunca viu
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: Kotlin
 
The state of Jenkins pipelines or do I still need freestyle jobs
The state of Jenkins pipelines or do I still need freestyle jobsThe state of Jenkins pipelines or do I still need freestyle jobs
The state of Jenkins pipelines or do I still need freestyle jobs
 
Annotation processing
Annotation processingAnnotation processing
Annotation processing
 
How to approach building GUIs using PyQT
How to approach building GUIs using PyQTHow to approach building GUIs using PyQT
How to approach building GUIs using PyQT
 
Untitled talk at Riviera.rb
Untitled talk at Riviera.rbUntitled talk at Riviera.rb
Untitled talk at Riviera.rb
 
Hands on clang-format
Hands on clang-formatHands on clang-format
Hands on clang-format
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
 
Angular Vienna - Use React tools for better Angular apps
Angular Vienna - Use React tools for better Angular appsAngular Vienna - Use React tools for better Angular apps
Angular Vienna - Use React tools for better Angular apps
 
2nd presantation
2nd presantation2nd presantation
2nd presantation
 
freeCodeCamp Tokyo meetup 19
freeCodeCamp Tokyo meetup 19freeCodeCamp Tokyo meetup 19
freeCodeCamp Tokyo meetup 19
 
Building End-to-End Apps Using Typescript
Building End-to-End Apps Using TypescriptBuilding End-to-End Apps Using Typescript
Building End-to-End Apps Using Typescript
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHP
 
Review: Apitrace and Vogl
Review: Apitrace and VoglReview: Apitrace and Vogl
Review: Apitrace and Vogl
 
Clang compiler `
Clang compiler `Clang compiler `
Clang compiler `
 
Last Month in PHP - June through Mid-July 2017
Last Month in PHP - June through Mid-July 2017Last Month in PHP - June through Mid-July 2017
Last Month in PHP - June through Mid-July 2017
 
Drupal and testing (2010 - 2011 / 2)
Drupal and testing (2010 - 2011 / 2)Drupal and testing (2010 - 2011 / 2)
Drupal and testing (2010 - 2011 / 2)
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScript
 
Use React tools for better Angular apps
Use React tools for better Angular appsUse React tools for better Angular apps
Use React tools for better Angular apps
 

Similar to .NET compiler platform codename Roslyn

Auto cad 2006_api_overview
Auto cad 2006_api_overviewAuto cad 2006_api_overview
Auto cad 2006_api_overview
scdhruv5
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
Tim Burks
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
lolopetit
 

Similar to .NET compiler platform codename Roslyn (20)

Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo MazzaferroRESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
 
How to contribute textual tooling for apache camel in several id es
How to contribute textual tooling for apache camel in several id esHow to contribute textual tooling for apache camel in several id es
How to contribute textual tooling for apache camel in several id es
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Auto cad 2006_api_overview
Auto cad 2006_api_overviewAuto cad 2006_api_overview
Auto cad 2006_api_overview
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
 
Assembly thy Web
Assembly thy WebAssembly thy Web
Assembly thy Web
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
Dust.js
Dust.jsDust.js
Dust.js
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the DatabaseExperiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the Database
 

More from Piotr Benetkiewicz (6)

Deep dive into Fastly
Deep dive into FastlyDeep dive into Fastly
Deep dive into Fastly
 
So, you wanna build a SSO
So, you wanna build a SSOSo, you wanna build a SSO
So, you wanna build a SSO
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Automatic system tests of web applications
Automatic system tests of web applicationsAutomatic system tests of web applications
Automatic system tests of web applications
 
Linq and Orcas
Linq and OrcasLinq and Orcas
Linq and Orcas
 
NET flow
NET flowNET flow
NET flow
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

.NET compiler platform codename Roslyn

  • 2. Agenda ● Introduction, background, history ● Roslyn in new VS 2015 ● Syntax API ● Semantics ● Compilation ● Analyzers, Fixes ● Scripting
  • 3. When, what, why ● .NET compiler platform ● Compiler as a service, csc.exe API ● Started 2008 (PDC, Los Angeles, CA) ● Codeplex -> Github ● Now in beta RC on nuget ● VS 2015
  • 4. What, when, why cont. ● “Poor” csc architecture o Different compiler forks for different tasks o clear C# and VB separation ● C++ vs. .NET languages Have you ever tried cat food?
  • 6.
  • 7.
  • 8. Roslyn must ● Have great throughput ● Be error insensitive ● Have great sense of error scope ● Support REPL-like scenarios ● be VS-agnostic
  • 9. Getting started ● VS 2015 CTP6 o watch out for side-by-side installation! ● VS SDK ● Install-Package Microsoft.CodeAnalysis -Pre ● Optional: o .NET Compiler Platform SDK Templates o Syntax Visualizer extension
  • 10. DEMO
  • 12. Syntax cont. ● SyntaxTree - base abstraction, immutable ● Building ST o from source o using factory methods ● Navigating ST o Members and casting o OfType<> o CSharpSyntaxWalker
  • 13. DEMO
  • 16. Semantics Yesterday a parrot will drive a bitter, encrypted car. ● english words ● punctuation ● yet it doesn’t make sense… ● binding
  • 17. Semantics cont. ● Get the real meaning of the abstract content ● Linking to a Symbol ● Needs context: o user defined (your code!) o external metadata (ex. mscorlib) ● Reflection on steroids (not at runtime) o GetSymbolInfo(), GetEnclosingSymbol() o Control flow analysis o Can be speculative
  • 18. Semantics is smart too! “Property is inaccessible due to its protection level” ● GetSpeculativeSymbolInfo() ● ISymbolInfo.CandidateSymbols
  • 19. DEMO
  • 20. Analyzers, code fixes ● VS project templates ● Derive from DiagnosticAnalyzer and apply DiagnosticAnalyzer attribute ● Derive from CodeFixProvider and apply ExportCodeFixProvider attribute ● Use “Add analyzer” in VS, nuget or csc.exe
  • 22. DEMO
  • 23. What to expect after Roslyn ships? ● Better vanilla VS user experience ● Alternative IDEs Editors (OmniSharp) ● Even richer toolset (CI, metrics, diagnostics) ● Scripting (sciptcs) ● Exciting community and commercial projects o code mutation o ConfigR
  • 24. Thank you ● @pbenetkiewicz ● http://benetkiewicz.github.io/blog/ ● pbenetkiewicz@gmail.com, piotr@ais.pl