compiler - microsoft.com · compiler pipeline compiler api binding & flow analysis apis symbol...

19

Upload: others

Post on 06-Aug-2020

57 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol
Page 2: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

Compiler

Compiler

Source code

Source code

Source

File Source code

Source code

.NET

Assembly

Class

Field

public Foo

private

string

X

Language

Object Model Read-Eval-Print Loop

Hosting in

other contexts DSL Embedding

Page 3: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

• Includes:− Managed compilers + language services

− Code analysis APIs

− Language service extensibility

− Read-Eval-Print-Loop (REPL)

Page 4: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

Symbol Table

Binder IL

Emitter Parser

Metadata

Import

Compiler

Pipeline

Page 5: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

Symbol

Table Binder

IL

Emitter Parser

Metadata

Import

Compiler

Pipeline

Compiler

API

Binding & Flow

Analysis APIs

Symbol

API

Syntax

Tree API

Emit

API

Page 6: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

Compiler

Pipeline Binding & Flow

Analysis APIs

Symbol

API

Syntax

Tree API

Emit

API

Language

Service

Page 7: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol
Page 8: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

MethodDeclaration

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

ParameterList Block

Page 9: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M

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

ParameterList Block

( ) { }

Page 10: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M ParameterList Block

( )

{ }

SP EOL EOL // C

SPx4 SP

EOL

EOL

EOL SPx4 EOL SPx4

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

Page 11: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M

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

ParameterList Block

( ) { }

Page 12: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M ParameterList Block

( ) { }

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

Page 13: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M

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

ParameterList Block

( ) { } Parameter

int

x PredefinedType

Page 14: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

CompilationUnit

TypeDeclaration

class C { MethodDeclaration }

EOF

void M

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

ParameterList Block

( ) { } Parameter

int

x PredefinedType

Page 15: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol

Trees

References

Compilation

• Symbols

• Binding

• Flow Analysis

• Diagnostics

• Emit

Page 16: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol
Page 17: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol
Page 18: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol
Page 19: Compiler - microsoft.com · Compiler Pipeline Compiler API Binding & Flow Analysis APIs Symbol API Syntax Tree API Emit API . Compiler Pipeline Binding & Flow Analysis APIs Symbol