Post on 13-Jul-2015
► [Introduction]Compilateur et méta programmation
► Roslyn
► [Coding]Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
► [Introduction]Compilateur et méta programmation
► Roslyn
► [Coding]Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
Compilateur et meta-programmation
Définition
La métaprogrammation désigne l'écriture de programmes qui manipulent des données décrivant elles-mêmes des programmes.
Wikipédia
Compilateur et meta-programmation
Compilateurs
var x = 10; var y = 20; if(x == y) {}
IL_0001: ldc.i4.s 0A IL_0003: stloc.0 IL_0004: ldc.i4.s 14 IL_0006: stloc.1 IL_0007: ldloc.0 IL_0008: ldloc.1 IL_0009: ceqIL_000B: ldc.i4.0 IL_000C: ceqIL_000E: stloc.2 IL_000F: ldloc.2 IL_0010: brtrue.s IL_0014 IL_0012: nop
► [Introduction]Compilateur et méta programmation
► Roslyn
► [Coding]Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
Roslyn
Octobre 2011
CommunityTechnology Preview
Evangélisation(MVP Matthieu Mezil)
2012 Février
Major Updates & Breakingchanges
Septembre 2012
Roslyn
Octobre 2011
CommunityTechnology Preview
Evangélisation(MVP Matthieu Mezil)
2012 Février
Major Updates & Breakingchanges
Septembre 2012
Roslyn
Ressources
Api & templates téléchargeables pour VS 2012.
Exemple format Word
Packages NuGetDisponible pour les autres versions de Visual Studio.
► [Introduction] Compilateur et méta programmation
► Roslyn
► [Coding] Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
[Coding] Syntaxe et Sémantique
Grammaire & langage
Grammaire (Arbre syntaxique)
ArgumentListSyntax paramètre de méthode ClassDeclarationSyntax déclaration d’une classe ExpressionStatementSyntax ligne de code UsingDirectiveSyntax using d’un namespace ...
Sémantique (Symbol) SemanticModel
GetTypeInfo() résultat de l’expression
(struct) CommonSymbolKind.Event .Field .Property
[Coding] Syntaxe et Sémantique
Syntax
SyntaxNode: Blue
SyntaxToken: Green
SyntaxTrivia: Red
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World");
}
}
[Coding] Syntaxe et Sémantique
ExpressionStatementSyntax
BinaryExpressionSyntax
IdentifierNameSyntax InvocationExpressionSyntax
[Coding] Syntaxe et Sémantique
InvocationExpressionSyntax
MemberAccessExpressionSyntax
ArgumentListSyntax
IdentifierNameSyntax IdentifierNameSyntax
► [Introduction] Compilateur et méta programmation
► Roslyn
► [Coding] Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
[Demo] Scripting et Compilation
Script CS
scriptcs makes it easy to write and execute C# with a simple text editor.
C:\> scriptcs scriptcs (ctrl-c or blank to exit)
> var message = "Hello, world!"; > Console.WriteLine(message); Hello, world! >
► [Introduction] Compilateur et méta programmation
► Roslyn
► [Coding] Syntaxe et Sémantique
► [Demo] Scripting et Compilation
► Le projet et son avenir
Agenda
Le projet et son avenir
Wish-list
Meilleur documentation (à jour!)
Full-Compatible avec VS 2013
Le retour de l’analyseur syntaxique
AOP