SlideShare uma empresa Scribd logo
1 de 40
Language framework in a managed environment Microsoft Development Center Copenhagen  Author:  João Filipe Gama de Magalhães E-mail: t-joaode@microsoft.com February 2008
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008
Objectives ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008
[object Object],[object Object],Compiler Structure Language framework in a managed environment February 2008 Lexical Analyzer Semantic Analyzer Syntactical Analyzer Code Generator AST source  file target file tokens
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Overview
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 GPLEX Scanner Generator I
Compiler Implementation Language framework in a managed environment February 2008 GPLEX Scanner Generator II %using gppg; %option minimize %namespace Microsoft.Dynamics.PBvNext.Modelling.ExpressionCompiler /* independent scanner section start */ %x COMMENT %x STRING %x METADATA White0  [ ] White  {White0}| CmntStart   CmntEnd   ABStar  [^]* ABStar2  [^amp;quot;]* NONl  [^]* StrStart  amp;quot; StrEnd  amp;quot;
Compiler Implementation Language framework in a managed environment February 2008 GPLEX Scanner Generator III %{ %} if  { return (int)Tokens.KWIF; } switch  { return (int)Tokens.KWSWITCH; } case  { return (int)Tokens.KWCASE; } [_][a-zA-Z0-9_]+  return (int)Tokens.IDENT; } [0-9]+  { return (int)Tokens.NUMBER; } {CmntStart}{ABStar}*{CmntEnd} { return (int)Tokens.LEX_COMMENT; }  {CmntStart}{ABStar}*  { BEGIN(COMMENT); return (int)Tokens.LEX_COMMENT; } <COMMENT>  |  <COMMENT>{ABStar}*  { return (int)Tokens.LEX_COMMENT; } /* the end of the comment */ <COMMENT>{ABStar}*{CmntEnd}  { BEGIN(INITIAL); return (int)Tokens.LEX_COMMENT; } /* all the other cases */ .  { yyerror(&quot;illegal char&quot;); return (int)Tokens.LEX_ERROR; } %{ %}
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 GPPG Parser Generator I
Compiler Implementation Language framework in a managed environment February 2008 GPPG Parser Generator II %using Microsoft.Dynamics.PBvNext.DataStructure.ExpressionAST %namespace Microsoft.Dynamics.PBvNext.Modelling.ExpressionCompiler %valuetype LexValue %partial %union { public string str; public AstNode node; } %{ public RootNode rootNode; %} %token KWIF KWSWITCH KWCASE %token STR CMT META IDENT NUMBER %left BARBAR AMPAMP %left '!' %left NEQ EQ %left '-' '+'
Compiler Implementation Language framework in a managed environment February 2008 GPPG Parser Generator III %% E : B { rootNode = new RootNode((ExpressionNode) $1.node);  } | { rootNode = new RootNode(); } ; B : B AMPAMP B { $$.node = new BinaryBooleanExpressionNode(BooleanOperationType.AND, (ExpressionNode) $1.node, (ExpressionNode) $3.node); } ; A : A '+' A { $$.node = new BinaryArithmeticExpressionNode(ArithmeticOperationType.PLUS, (ArithmeticExpressionNode) $1.node, (ArithmeticExpressionNode) $3.node); } A : A '+' error {throw new ParsingError(”Error reducing literal expression”); } ; L : ATTR  { $$.node = new AttributeNode($1.str); } | CONST { $$.node = new ConstantNode(Int32.Parse($1.str)); } | error { throw new ParsingError(”Error reducing literal expression”); } ; CONST : NUMBER { $$.str = $1.str; } ; ATTR : IDENT  { $$.str = $1.str; } ;
Compiler Implementation Language framework in a managed environment February 2008 GPPG and GPLEX // creates a new scanner Scanner scanner =  new  Scanner();   // creates a new parser Parser parser =  new  Parser();   // sets the scanner for the parser parser.scanner = scanner;   // sets the stream to parse scanner.buffer =  new  Scanner.StringBuff( this .Value);   // parses the file parser.Parse();   // retrieves the output root node this .RootNode = parser.rootNode;
Compiler Implementation ,[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Visitor Pattern I
Compiler Implementation Language framework in a managed environment February 2008 Visitor Pattern II
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Visitor Pattern III
Compiler Implementation ,[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Semantic Analysis I
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Semantic Analysis II
Compiler Implementation ,[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Code Generation I
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Code Generation II
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 XML Interpretation I
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 XML Interpretation II
Compiler Implementation ,[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Compiler Services I
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Compiler Services II
Compiler Implementation ,[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Adapter and Plug-ins I
Compiler Implementation Language framework in a managed environment February 2008 Adapter and Plug-ins II
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Adapter and Plug-ins III
Compiler Implementation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Adapter and Plug-ins IV
Developed Solution ,[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Introduction
Developed Solution ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 Project Description
Developed Solution ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 The Pml Language
Developed Solution Language framework in a managed environment February 2008 The Modeling Environment Compiler Tools Pml Compiler Client Code Generator Lexical Analyzer Semantic Analyzer Syntactical Analyzer Pml Code Tools Syntax Highlighter Code Completer AST
Developed Solution ,[object Object],[object Object],Language framework in a managed environment February 2008 The Compiler ,[object Object]
Developed Solution ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 The Compiler Tools
Developed Solution Language framework in a managed environment February 2008 The Configuration Environment Configuration Engine Adapter Abstraction Layer Microsoft Constraint Solver Adapter Microsoft Parallel Constraint Solver Adapter Interpretation Tools Client API Microsoft Parallel Constraint Solver Microsoft Constraint Solver AST Adapters
Developed Solution ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 The Interpretation Tools
Developed Solution ,[object Object],[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 The Adapter Abstraction Layer
Developed Solution ,[object Object],[object Object],[object Object],[object Object],Language framework in a managed environment February 2008 The Configuration Engine
Demo Language framework in a managed environment February 2008 Demo
[object Object],[object Object],[object Object],[object Object],[object Object],Conclusions Language framework in a managed environment February 2008
[object Object],Questions Language framework in a managed environment February 2008

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

C++ Training
C++ TrainingC++ Training
C++ Training
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
R package development, create package documentation isabella gollini
R package development, create package documentation   isabella golliniR package development, create package documentation   isabella gollini
R package development, create package documentation isabella gollini
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futures
 
C++11
C++11C++11
C++11
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
 
Data types in c++
Data types in c++ Data types in c++
Data types in c++
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
What's New In C# 5.0 - Rumos InsideOut
What's New In C# 5.0 - Rumos InsideOutWhat's New In C# 5.0 - Rumos InsideOut
What's New In C# 5.0 - Rumos InsideOut
 
Go Language Hands-on Workshop Material
Go Language Hands-on Workshop MaterialGo Language Hands-on Workshop Material
Go Language Hands-on Workshop Material
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functions
 
Function in C program
Function in C programFunction in C program
Function in C program
 
C++ presentation
C++ presentationC++ presentation
C++ presentation
 
C and C++ functions
C and C++ functionsC and C++ functions
C and C++ functions
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Functions
FunctionsFunctions
Functions
 
Whats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPontoWhats New In C# 4 0 - NetPonto
Whats New In C# 4 0 - NetPonto
 
C++ Overview
C++ OverviewC++ Overview
C++ Overview
 

Semelhante a Managed Compiler

The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersAlessandro Sanino
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET componentsBình Trọng Án
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesEelco Visser
 
AD215 - Practical Magic with DXL
AD215 - Practical Magic with DXLAD215 - Practical Magic with DXL
AD215 - Practical Magic with DXLStephan H. Wissel
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptdominion
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe MassesHolger Schill
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overviewbwullems
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applicationsDeepankar Pathak
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Robert Pickering
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web ApplicationRishi Kothari
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 

Semelhante a Managed Compiler (20)

The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
 
Basics1
Basics1Basics1
Basics1
 
AD215 - Practical Magic with DXL
AD215 - Practical Magic with DXLAD215 - Practical Magic with DXL
AD215 - Practical Magic with DXL
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overview
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applications
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Managed Compiler

  • 1. Language framework in a managed environment Microsoft Development Center Copenhagen Author: João Filipe Gama de Magalhães E-mail: t-joaode@microsoft.com February 2008
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Compiler Implementation Language framework in a managed environment February 2008 GPLEX Scanner Generator II %using gppg; %option minimize %namespace Microsoft.Dynamics.PBvNext.Modelling.ExpressionCompiler /* independent scanner section start */ %x COMMENT %x STRING %x METADATA White0 [ ] White {White0}| CmntStart CmntEnd ABStar [^]* ABStar2 [^amp;quot;]* NONl [^]* StrStart amp;quot; StrEnd amp;quot;
  • 8. Compiler Implementation Language framework in a managed environment February 2008 GPLEX Scanner Generator III %{ %} if { return (int)Tokens.KWIF; } switch { return (int)Tokens.KWSWITCH; } case { return (int)Tokens.KWCASE; } [_][a-zA-Z0-9_]+ return (int)Tokens.IDENT; } [0-9]+ { return (int)Tokens.NUMBER; } {CmntStart}{ABStar}*{CmntEnd} { return (int)Tokens.LEX_COMMENT; } {CmntStart}{ABStar}* { BEGIN(COMMENT); return (int)Tokens.LEX_COMMENT; } <COMMENT> | <COMMENT>{ABStar}* { return (int)Tokens.LEX_COMMENT; } /* the end of the comment */ <COMMENT>{ABStar}*{CmntEnd} { BEGIN(INITIAL); return (int)Tokens.LEX_COMMENT; } /* all the other cases */ . { yyerror(&quot;illegal char&quot;); return (int)Tokens.LEX_ERROR; } %{ %}
  • 9.
  • 10. Compiler Implementation Language framework in a managed environment February 2008 GPPG Parser Generator II %using Microsoft.Dynamics.PBvNext.DataStructure.ExpressionAST %namespace Microsoft.Dynamics.PBvNext.Modelling.ExpressionCompiler %valuetype LexValue %partial %union { public string str; public AstNode node; } %{ public RootNode rootNode; %} %token KWIF KWSWITCH KWCASE %token STR CMT META IDENT NUMBER %left BARBAR AMPAMP %left '!' %left NEQ EQ %left '-' '+'
  • 11. Compiler Implementation Language framework in a managed environment February 2008 GPPG Parser Generator III %% E : B { rootNode = new RootNode((ExpressionNode) $1.node); } | { rootNode = new RootNode(); } ; B : B AMPAMP B { $$.node = new BinaryBooleanExpressionNode(BooleanOperationType.AND, (ExpressionNode) $1.node, (ExpressionNode) $3.node); } ; A : A '+' A { $$.node = new BinaryArithmeticExpressionNode(ArithmeticOperationType.PLUS, (ArithmeticExpressionNode) $1.node, (ArithmeticExpressionNode) $3.node); } A : A '+' error {throw new ParsingError(”Error reducing literal expression”); } ; L : ATTR { $$.node = new AttributeNode($1.str); } | CONST { $$.node = new ConstantNode(Int32.Parse($1.str)); } | error { throw new ParsingError(”Error reducing literal expression”); } ; CONST : NUMBER { $$.str = $1.str; } ; ATTR : IDENT { $$.str = $1.str; } ;
  • 12. Compiler Implementation Language framework in a managed environment February 2008 GPPG and GPLEX // creates a new scanner Scanner scanner = new Scanner();   // creates a new parser Parser parser = new Parser();   // sets the scanner for the parser parser.scanner = scanner;   // sets the stream to parse scanner.buffer = new Scanner.StringBuff( this .Value);   // parses the file parser.Parse();   // retrieves the output root node this .RootNode = parser.rootNode;
  • 13.
  • 14. Compiler Implementation Language framework in a managed environment February 2008 Visitor Pattern II
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Compiler Implementation Language framework in a managed environment February 2008 Adapter and Plug-ins II
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31. Developed Solution Language framework in a managed environment February 2008 The Modeling Environment Compiler Tools Pml Compiler Client Code Generator Lexical Analyzer Semantic Analyzer Syntactical Analyzer Pml Code Tools Syntax Highlighter Code Completer AST
  • 32.
  • 33.
  • 34. Developed Solution Language framework in a managed environment February 2008 The Configuration Environment Configuration Engine Adapter Abstraction Layer Microsoft Constraint Solver Adapter Microsoft Parallel Constraint Solver Adapter Interpretation Tools Client API Microsoft Parallel Constraint Solver Microsoft Constraint Solver AST Adapters
  • 35.
  • 36.
  • 37.
  • 38. Demo Language framework in a managed environment February 2008 Demo
  • 39.
  • 40.

Notas do Editor

  1. Welcome and thank you all for coming. My name is Joao Magalhães, I’m a trainee from the Product Builder team and I’m here to give a presentation about the creation of compilers in a managed environment. For this presentation I’m using some of he work developed during my final (thesis) project for my Master degree.