• Save
Roslyn   un compiltaore per amico
Upcoming SlideShare
Loading in...5
×
 

Roslyn un compiltaore per amico

on

  • 633 views

 

Statistics

Views

Total Views
633
Views on SlideShare
633
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • First the parse phase, where source is tokenized and parsed into syntax that follows the language grammar. Second the declaration phase, where declarations from source and imported metadata are analyzed to form named symbols. Next the bind phase, where identifiers in the code are matched to symbols. Finally, the emit phase, where all the information built up by the compiler is emitted as an assembly.
  • The parsing phase is exposed as a syntax tree, the declaration phase as a hierarchical symbol table, the binding phase as a model that exposes the result of the compiler’s semantic analysis and the emit phase as an API that produces IL byte codes.
  • The compiler layer contains the object models that correspond with information exposed at each phase of the compiler pipeline, both syntactic and semantic. The compiler layer also contains a representation of a single invocation of a compiler, including assembly references, compiler options, and source code files. There are two distinct, but similar in shape, APIs that represent the C# language and the Visual Basic language. This layer has no dependencies on Visual Studio components.The scripting layer represents a runtime execution context for C# or Visual Basic snippets of code. It contains a scripting engine that allows evaluation of expressions and statements as top-level constructs in programs. This layer has no dependencies on Visual Studio components.The workspace layer is the starting point for doing code analysis and refactoring over entire solutions. It assists you in organizing all the information about the projects in a solution into single object model, offering you direct access to the compiler layer object models without needing to parse files, configure options or manage project to project dependencies.This layer is commonly used when implementing code analysis and refactoring tools that function within a host environment like the Visual Studio IDE, however it has no dependencies on Visual Studio components.The services layer contains all the Visual Studio IDE features, such as IntelliSense, refactorings, and code formatting features. It also contains the Services APIs, which allow a user to easily extend Visual Studio. This layer has a dependency on the Visual Studio text editor and the Visual Studio software development kit (SDK).

Roslyn   un compiltaore per amico Roslyn un compiltaore per amico Presentation Transcript

  • Roslynun compilatore per amico
  • about meAlessandro Melchiorialessandro@codiceplastico.com@amelchiori
  • why? ?
  • compiler pipeline symbols parser binder IL emitter metadata import
  • compiler API binding and syntax tree API symbol API flow analysys emit API API
  • edit and continue go to definition extract method signature help quick info renamelanguage service find all references completion list object browser navigate to outlining colorizer formatter
  • API layers compilers scripting workspace services
  • working with syntaxSyntax tree: represent the lexical and syntactic structure of source codeo full fidelityo round-trippable backo ImmutableSyntax node: represent syntactic constructs (such as declarations, statements,clauses and expression)Syntax tokens: represent the smallest syntactic fragment of the codeSyntax trivia: represent the parts of the source text that are largely insignificantfor normal understanding of the code (such as whitespace, comments andprocessor directives)SpansKindsErrors
  • working with semanticCompilation: represent everything needed to compile C# or VB.Net program(including all the assembly references, compiler options and source files)Symbol: represents a distinct element declared by source code or imported froman assembly as metadataSemantic model: represents all the semantic information for a single source file