roslyn: another introduction

Post on 21-Jan-2018

918 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

roslyn:another introductionMiguel Fernández

@dotnetmalaga

compiler

"computer program that translates a program

written in a high-level language into another

language, usually machine language“

wordreference.com

3

2016

@dotnetmalaga

compilers

classic compiler

CompilerSource codeExecutable

program

4

2016

@dotnetmalaga

compilers

syntax analysis

5

2016

@dotnetmalaga

compilers

phases

6

2016

@dotnetmalaga

compilers

grammarsJSON

roslyn

“Set of open-source compilers and code

analysis APIs for C# and Visual Basic .NET”

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

9

2016

@dotnetmalaga

C# timeline

Source: wikipedia.org

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

11

2016

@dotnetmalaga

compilers

compiler as a service

12

2016

@dotnetmalaga

compilers

syntax tree

class Person{

string name;}

roslyn demo 1

basic parse and syntax tree

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

15

2016

@dotnetmalaga

roslyn

ecosystem

roslyn analyzers

Wintellect analyzers

roslyn demo 2

enforce naming conventions

roslyn demo 3

“mientras” loop

18

2016

@dotnetmalaga

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

• Roslyn on GitHub

• Josh Varty blog + Channel9 videos

• Wikipedia

references

19

2016

@dotnetmalaga

top related