roslyn: another introduction

19
roslyn: another introduction Miguel Fernández @dotnetmalaga

Upload: miguel-fernandez

Post on 21-Jan-2018

918 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Roslyn: another introduction

roslyn:another introductionMiguel Fernández

@dotnetmalaga

Page 2: Roslyn: another introduction

compiler

"computer program that translates a program

written in a high-level language into another

language, usually machine language“

wordreference.com

Page 3: Roslyn: another introduction

3

2016

@dotnetmalaga

compilers

classic compiler

CompilerSource codeExecutable

program

Page 4: Roslyn: another introduction

4

2016

@dotnetmalaga

compilers

syntax analysis

Page 5: Roslyn: another introduction

5

2016

@dotnetmalaga

compilers

phases

Page 6: Roslyn: another introduction

6

2016

@dotnetmalaga

compilers

grammarsJSON

Page 7: Roslyn: another introduction

roslyn

“Set of open-source compilers and code

analysis APIs for C# and Visual Basic .NET”

Page 8: Roslyn: another introduction

8

2016

@dotnetmalaga

Finally, why “Roslyn”? I was the one who came up with this silly name. Almost

all Microsoft product code names are now city or town names. It’s unlikely that

the lovely and historic town of Roslyn, Washington is going to object to us

using their name. But if we chose the name of a copyrighted character or

fictional location from a book or movie then there might be a legal issue there,

and obviously names already taken by other products are right out.

But more importantly my office has a northern exposure.

roslyn

name

Page 9: Roslyn: another introduction

9

2016

@dotnetmalaga

C# timeline

Source: wikipedia.org

Page 10: Roslyn: another introduction

10

2016

@dotnetmalaga

• CaaS

• One parser to rule them all

• Managed code

• Backward compatible (even bugs!)

• Immutable data structures + round trip trees

• Open source

roslyn

roslyn design goals

Page 11: Roslyn: another introduction

11

2016

@dotnetmalaga

compilers

compiler as a service

Page 12: Roslyn: another introduction

12

2016

@dotnetmalaga

compilers

syntax tree

class Person{

string name;}

Page 13: Roslyn: another introduction

roslyn demo 1

basic parse and syntax tree

Page 14: Roslyn: another introduction

14

2016

@dotnetmalaga

roslyn

Projects 139

Documents 10,038

Lines of code 3,678,210

Types 13,436

Public types 4,043

some numbers

Comparision: informationisbeautiful.net

86,000 LoC

my current

project

Page 15: Roslyn: another introduction

15

2016

@dotnetmalaga

roslyn

ecosystem

roslyn analyzers

Wintellect analyzers

Page 16: Roslyn: another introduction

roslyn demo 2

enforce naming conventions

Page 17: Roslyn: another introduction

roslyn demo 3

“mientras” loop

Page 18: Roslyn: another introduction

18

2016

@dotnetmalaga

• Compilers: Principles, Techniques, and Tools (2nd Edition)

• Roslyn on GitHub

• Josh Varty blog + Channel9 videos

• Wikipedia

references

Page 19: Roslyn: another introduction

19

2016

@dotnetmalaga