SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
Code generation
private field with getter and setterfield
via getters and settersassignment
print statement System.out.println



Java class (separate file)
for every entity
public classentity 
generated code
Code generation
“take” only entities from the input
resource contains EMF model
representation of the program
file path
file contents not needed – base type of hierarchy,
no specific features
not needed
compile – will be
invoked recursively
Xtend Multiline template expressions
// Visual Basic
Dim unit As String
// Delphi
unit:String;
// Delphi .NET
@unit:String;
// C++
// create 10 variables
// each with one tab indentation
String unit1;
String unit2;
String unit3;
...
{ and } can be omitted
if only template
expression in body
guillemets  Shift + Ctrl + < or > Alt + q or Q
conditional
IF … ELSE … ENDIF
loop
FOR … ENDFOR
any expression within
guillemets, including
method invocation
Code generator in Xtend
indentation handled in a
smart way by Xtend
private n;
public int getN() {
return n;
}
public void setN(int value) {
this.n = value;
}
Compiling entity
Code generator in Xtend
Stringtext 
intnumber 
booleantoggle 
Type names
selection will use runtime type of fieldType
polymorphic method overloading (dispatch methods)
FieldType
BasicType:
FieldType
EntityType:
FieldType
Code generator in Xtend Statements and expressions
integer value (converted to string)
string value in quotes
on  true
off  false

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
What is the deal with Elixir?
What is the deal with Elixir?What is the deal with Elixir?
What is the deal with Elixir?
 
TDoc - Bringing Documentation to Tool
TDoc - Bringing Documentation to ToolTDoc - Bringing Documentation to Tool
TDoc - Bringing Documentation to Tool
 
Jdt Features
Jdt FeaturesJdt Features
Jdt Features
 
Parser
ParserParser
Parser
 
OOP Poster Presentation
OOP Poster PresentationOOP Poster Presentation
OOP Poster Presentation
 
JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor Aspect
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
Java tokens
Java tokensJava tokens
Java tokens
 
Microsoft Silverlight
Microsoft SilverlightMicrosoft Silverlight
Microsoft Silverlight
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
introduction to Python | Part 1
introduction to Python | Part 1introduction to Python | Part 1
introduction to Python | Part 1
 
Keyword Presentation
Keyword PresentationKeyword Presentation
Keyword Presentation
 
Basics1
Basics1Basics1
Basics1
 
tokens patterns and lexemes
tokens patterns and lexemestokens patterns and lexemes
tokens patterns and lexemes
 
code analysis for c++
code analysis for c++code analysis for c++
code analysis for c++
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
C presentation
C presentationC presentation
C presentation
 
Code quality
Code qualityCode quality
Code quality
 
C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data Types
 

Semelhante a Xtext: code generation

03 oo with-c-sharp
03 oo with-c-sharp03 oo with-c-sharp
03 oo with-c-sharp
Naved khan
 
GEM - GNU C Compiler Extensions Framework
GEM - GNU C Compiler Extensions FrameworkGEM - GNU C Compiler Extensions Framework
GEM - GNU C Compiler Extensions Framework
Alexey Smirnov
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
sarfarazali
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
singhadarsh
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
NALESVPMEngg
 

Semelhante a Xtext: code generation (20)

03 oo with-c-sharp
03 oo with-c-sharp03 oo with-c-sharp
03 oo with-c-sharp
 
P/Invoke - Interoperability of C++ and C#
P/Invoke - Interoperability of C++ and C#P/Invoke - Interoperability of C++ and C#
P/Invoke - Interoperability of C++ and C#
 
GEM - GNU C Compiler Extensions Framework
GEM - GNU C Compiler Extensions FrameworkGEM - GNU C Compiler Extensions Framework
GEM - GNU C Compiler Extensions Framework
 
srgoc
srgocsrgoc
srgoc
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
from java to c
from java to cfrom java to c
from java to c
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plus
 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)
 
EclipseCon 2005: Everything You Always Wanted to do with EMF (But were Afraid...
EclipseCon 2005: Everything You Always Wanted to do with EMF (But were Afraid...EclipseCon 2005: Everything You Always Wanted to do with EMF (But were Afraid...
EclipseCon 2005: Everything You Always Wanted to do with EMF (But were Afraid...
 
Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharp
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation Stal
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 

Mais de Mikhail Barash

Mais de Mikhail Barash (20)

MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
 
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
 
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
 
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept EntityMODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
 
Towards a mnemonic classification of software languages
Towards a mnemonic classification of software languagesTowards a mnemonic classification of software languages
Towards a mnemonic classification of software languages
 
Worst practices for domain-specific modelling
Worst practices for domain-specific modellingWorst practices for domain-specific modelling
Worst practices for domain-specific modelling
 
An ABC of JetBrains MPS
An ABC of JetBrains MPSAn ABC of JetBrains MPS
An ABC of JetBrains MPS
 
KernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in JetBrains MPSKernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in JetBrains MPS
 
Reflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university courseReflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university course
 
Language Workbench Language Wheel
Language Workbench Language WheelLanguage Workbench Language Wheel
Language Workbench Language Wheel
 
DSL development
DSL developmentDSL development
DSL development
 
Design concerns for concrete syntax
Design concerns for concrete syntaxDesign concerns for concrete syntax
Design concerns for concrete syntax
 
Xtext: type checking and scoping
Xtext: type checking and scopingXtext: type checking and scoping
Xtext: type checking and scoping
 
Xtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formattingXtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formatting
 
Xtend Programming Language
Xtend Programming LanguageXtend Programming Language
Xtend Programming Language
 
Language Workbenches
Language WorkbenchesLanguage Workbenches
Language Workbenches
 
Implementing DSLs in practice
Implementing DSLs in practiceImplementing DSLs in practice
Implementing DSLs in practice
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
 
DSLs: what, why, how
DSLs: what, why, howDSLs: what, why, how
DSLs: what, why, how
 
Zoo of domain-specific languages
Zoo of domain-specific languagesZoo of domain-specific languages
Zoo of domain-specific languages
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 

Xtext: code generation

  • 1. Code generation private field with getter and setterfield via getters and settersassignment print statement System.out.println    Java class (separate file) for every entity public classentity  generated code
  • 2. Code generation “take” only entities from the input resource contains EMF model representation of the program file path file contents not needed – base type of hierarchy, no specific features not needed compile – will be invoked recursively
  • 3. Xtend Multiline template expressions // Visual Basic Dim unit As String // Delphi unit:String; // Delphi .NET @unit:String; // C++ // create 10 variables // each with one tab indentation String unit1; String unit2; String unit3; ... { and } can be omitted if only template expression in body guillemets  Shift + Ctrl + < or > Alt + q or Q conditional IF … ELSE … ENDIF loop FOR … ENDFOR any expression within guillemets, including method invocation
  • 4. Code generator in Xtend indentation handled in a smart way by Xtend private n; public int getN() { return n; } public void setN(int value) { this.n = value; } Compiling entity
  • 5. Code generator in Xtend Stringtext  intnumber  booleantoggle  Type names selection will use runtime type of fieldType polymorphic method overloading (dispatch methods) FieldType BasicType: FieldType EntityType: FieldType
  • 6. Code generator in Xtend Statements and expressions integer value (converted to string) string value in quotes on  true off  false