SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
A DSTL To
Bridge Concrete and
Abstract Syntax
Adolfo Sánchez-Barbudo Herrera, Edward D. Willink and
Richard F. Paige
Agenda
● Scope
● Problem
● Solution
● Comparative Study
2
Scope
● Complex Textual Modeling Languages
○ CS is textual (particularly, defined by a grammar)
○ AS is model-based (particularly, defined by a meta-model)
○ Complex Language = AS definition can not be directly inferred from CS definition
● Examples
○ Languages specified by OMG, such as OCL and QVT languages.
○ OCL specification defines the CS via a grammar (Clause 9.3)
○ OCL specification defines the AS via a meta-model (Clause 8)
○ OCL specification describes how to obtain AS from CS (Clause 9.4)
3
Agenda
● Scope
● Problem
● Solution
● Comparative Study
4
Problem
● Related works (e.g. Xtext) allow to map CS grammars to AS meta-models, but...
● let … in x.y -- an OCL expression
○ ‘y’ is a navigation (i.e. a PropertyCallExp in the AS)
○ ‘x’ ? → It depends on the context
y:
Property
CallExp
x:
VariableExp
ownedSource
x:
Property
CallExp
self:
VariableExp
y:
Property
CallExp
ownedSource ownedSource
‘x’ is a
variable name
‘x’ is a
property name
(i.e self.x.y)
5
Problem II
CallExpCS:
PrimaryExpCS ( ('.' | '->') NameExpCS)*
NameExpCS:
SimpleNameCS (RoundedBracketClauseCS)?
SimpleNameCS:
ID;
RoundedBracketClauseCS:
'(' (ExpCS (',' ExpCS)* )? ')'
OCLExpression
Operation
CallExp
Variable
Exp
Property
CallExp
Problem: Syntactically, it can not be determined if a simple name corresponds
to a PropertyCallExp or VariableExp
6
Problem III
● Support to non-simple (i.e. 1-1) CS2AS mappings
○ e.g. a NameExpCS may map to a VariableExp and PropertyCallExp (output pattern)
● Support to cross-references computation
○ e.g. an OCLExpression is a TypedElement: it requires a type cross-reference to be computed
● Name resolution
○ Special case of cross-reference computation
○ e.g. a VariableExp requires to refer to a Variable.
● CS Disambiguation
○ e.g. a NameExpCS may map to either an OperationCallExp, or a PropertyCallExp, or a
VariableExp
7
Agenda
● Scope
● Problem
● Solution
● Comparative Study
8
Solution
Generates
Manual
artefact
Generated
artefact
AS
MM
conformsTo
AS
Model
conformsTo
Textual
Input
CS
Grammar
CS
MM
Parser
CS
Model
conformsTo
(e.g. like Xtext)
M2M tx
from to
CS2AS
Bridge
(modelware)
9
Solution II
● (External) DSTL to bridge CS and AS (meta-models).
● Why is domain-specific
○ Just one input domain and one output domain (no in-place tx)
○ Specific constructs for name resolution
○ Specific guards semantics for disambiguation rules
● Features:
○ Declarative (M2M) language
○ Resuses Essential OCL as expressions language
○ Currently, four sections
■ helpers
■ mappings
■ disambiguation rules
■ name resolution
10
DSTL: Helpers
● To define contextual operations
helpers {
NameExpCS::parentAsCallExpCS() : CallExpCS =
let container = self.oclContainer()
in if container.oclIsKindOf(CallExpCS)
then container.oclAsType(CallExpCS)
else null
endif
NameExpCS::isNameExpOfACallExpCS() : Boolean =
let parentCallExpCS = parentAsCallExpCS()
in parentCallExpCS <> null and parentCallExpCS.nameExp = self }
body
result
context
11
DSTL: Mappings
● To define mappings between CS and AS (meta-)classes
mappings {
map PropertyCallExp from NameExpCS
when isPropCallExpWithImplicitSource {
ownedSource := let referredVar = trace.lookup(Variable, 'self')
in VariableExp {
referredVariable = referredVar,
type = referredVar.type }
referredProperty := trace.lookupExported(Property,
trace.ownedSource.type, expName),
type := trace.referredProperty?.type}
}
Mapping guard
AS property
initialization
To access AS domain
from the CS one Lookup
expressions
Target AS
term
Source
CS term
12
DSTL: Mappings II
● Multi-way mappings (same NameExpCS mapped to different outcomes)
mappings {
map PropertyCallExp from NameExpCS
when isPropCallExpWithImplicitSource { … }
map PropertyCallExp from NameExpCS
when isPropCallExpWithExplicitSource { … }
map OperationCallExp from NameExpCS
when isOpCallExpWithExplicitSource { … }
map OperationCallExp from NameExpCS
when isOpCallExpWithExplicitSource { … }
map VariableExp from NameExpCS
when isVariableExp { … } }
Same source (CS)
Different
targets (AS)
13
DSTL: Disambiguation Rules
● To define disambiguation rules
disambiguation {
NameExpCS {
isOpCallExpWithImplicitSource := roundedBrackets <> null
and not isNameExpOfACallExpCS()
isOpCallExpWithExplicitSource := roundedBrackets <> null
and isNameExpOfACallExpCS()
isPropCallExpWithExplicitSource := roundedBrackets = null
and isNameExpOfACallExpCS()
isVariableExp := …
isPropCallExpWithImplicitSource := …
} }
CS element to
disambiguate
Disambiguation rule name
Boolean-valued
expression
Important: Order matters
14
Name Resolution
● Activity to solve AS cross-references, which involve a name-based lookup
○ From an AS element another named AS element needs to be found in the model.
○ Declaratively, it’s matter of how named elements are contributed to lookup scopes.
○ Scopes are key data structures that keep all visible named element within that scope.
● Scopes:
○ Current Scope
○ Exported Scope
○ Nested Scopes
15
Name Resolution II
● Current Scope
class C1 {
prop p1 : String;
op getP1(): String = p1;
}
:
Expression
InOCL
:
Property
CallExp
class C2 {
op getP1() : String = p1;
}
:
Expression
InOCL
:
Property
CallExp
C1:
Class
p1:
Property
getP1:
Operation
referredProperty
C2:
Class
getP1:
Operation
referredProperty
16
Name Resolution III
● Exported Scope
class C1 {
prop p1 : String;
op getP1(): String
= p1;
}
class C2 {
prop c1 : C1;
op getP1() : String
= c1.p1;
}
:
Expression
InOCL
:
Property
CallExp
:
Expression
InOCL
:
Property
CallExp
C1:
Class
p1:
Property
getP1:
Operation
referredProperty
getP1:
Operation
referredProperty
:
Property
CallExp
referredProperty
C2:
Class
c1:
Property
17
Name Resolution IV
● Nested Scope (name oclusssion)
-- valid expression which
-- evaluates to false
let v = ‘foo’
in let v = ‘bar’
in v = ‘foo’
‘foo’:
String
LiteralExp
:
LetExp
:
LetExp
v:
Variable
v:
Variable
‘bar’:
String
LiteralExp
‘foo’:
String
LiteralExp
‘=’:
Operation
CallExp
:
Variable
Exp
‘v’ ->
Variable (‘foo’)
‘v’ ->
Variable (‘bar’)parent
nested
18
DSTL: Name Resolution
● To define name resolution
targets {
NamedElement using name; -- ’name’: property used to identify ’targets’
Property; -- ’using’ is optional: extends a fully defined ’target’ element }
inputs {
SimpleNameCS using name; -- ’name’: property used to match ’targets’ }
providers {
Class {
in current-scope provides
occluding ownedProperties;
in exported-scope provides
ownedProperties; } } 19
DSTL: Name Resolution II
● Slightly more complex name resolution
providers {
Class {
in current-scope provides
occluding ownedProperties
occluding getAllSuperClasses().ownedProperties;
in exported-scope provides
ownedProperties
occluding getAllSuperClasses().ownedProperties;
}
}
20
DSTL: Name Resolution III
● Expressions to perform name-based lookups
trace.lookup(Variable, 'self')
Kind of target to look up
trace.lookupExported(Property,trace.ownedSource.type, expName)
The lookup input (a String)Lookup in current scope
Lookup in a exported scope
Kind of target to look up
Actual element providing the
exported scope
The lookup input (a SimpleNameCS)
21
Agenda
● Scope
● Problem
● Solution
● Comparative Study
22
Comparative Study: Gra2Mol
● Gra2Mol
○ DSTL can be used for the same purpose: bridging CS and AS syntax
○ Map arbitrary grammars to arbitrary AS meta-models
Source Target Nature Query
Language
Gra2Mol Grammar
Terms
AS MM
Terms
Declarative Structure-Shy
(Xpath Like)
CS2AS
DSTL
CS MM
Terms
AS MM
Terms
Declarative Statically Typed
(Essent. OCL)
23
Qualitative Study
● Gra2Mol pros:
○ Query Language is more concise (few and effort-saving navigation operators)
○ Provides a language extensibility mechanism
● CS2AS DSTL pros:
○ OCL has more expressive power (beyond simple model navigation)
○ AS model can be navigated (Gra2Mol QL only operates at CS level)
○ No coupling with a parsing technology
○ Declarative name resolution section saves encoding lookup algorithms
■ to resolve name-based cross-references
○ Ordering-based disambiguation rules description
■ to overcome their admitted limitation of having to define exclusive rule guards.
24
Quantitative Study: Example
company :
’company’ STRING ’{’ department* ’}’ EOF;
department :
’department’ STRING ’{’
department_manager
department_employees
department* ’}’;
department_manager :
’manager’ employee;
department_employees :
(’employee’ employee)*;
employee :
STRING ’{’
’address’ STRING
’salary’ FLOAT
(’mentor’ STRING)? ’}’; 25
Quantitative Study: Gra2Mol
rule 'mapDepartment'
from department d
to Department
queries
mElem : /d/department_manager/#employee;
eElem : /d/department_employees/#employee;
dElem : /d/#department;
mappings
name = removeQuotes d.STRING;
manager = mElem;
employees = eElem;
subdepts = dElem; end_rule 26
Quantitative Study: CS2AS DSTL
mappings {
map Department from department {
name := name;
manager := department_manager.employee.trace;
employees := department_employees.employee.trace;
subdepts := deparment.trace;
}
}
27
Quantitative Study: Inputs Generator
● Nd: No
of (top level) departments
● Ns: No
of subdeparments
○ per departement/subdepartment
● Ne: No
of employees
○ per departement/subdepartment
● Ds: Depth level of (sub)departments
ID Size
(bytes)
Elements Nd Ns Ne Ds
1 1,238 22 3 0 3 1
2 6,105 97 3 3 4 2
3 149,951 701 1 1 3 100
4 42,805 708 1 100 3 2
5 223,848 3061 4 4 5 4
6 1,018,254 11901 10 4 10 4
7 9,794,276 109341 10 5 10 5 28
Quantitative Study: Results
● CS2AS tx execution measured
● Overall: 10-fold improvement
● Input topology does not impact to
our solution
29
Thanks you very much !!!!
asbh500@york.ac.uk / me@adolfosbh.co
@adolfosbh
Questions ?
30

Más contenido relacionado

La actualidad más candente

Bca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsBca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsRai University
 
Gate Computer Science Solved Paper 2007
Gate Computer Science Solved Paper 2007 Gate Computer Science Solved Paper 2007
Gate Computer Science Solved Paper 2007 Rohit Garg
 
20110319 parameterized algorithms_fomin_lecture01-02
20110319 parameterized algorithms_fomin_lecture01-0220110319 parameterized algorithms_fomin_lecture01-02
20110319 parameterized algorithms_fomin_lecture01-02Computer Science Club
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17Daniel Eriksson
 
Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...Peter Breuer
 
OOP with Java - continued
OOP with Java - continuedOOP with Java - continued
OOP with Java - continuedRatnaJava
 
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Raffi Khatchadourian
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsNIT Sikkim
 
The what over the how (another way on android development with kotlin)
The what over the how (another way on android development with kotlin)The what over the how (another way on android development with kotlin)
The what over the how (another way on android development with kotlin)Jose Manuel Pereira Garcia
 
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...Mail.ru Group
 
Algorithm and Programming (Procedure and Function)
Algorithm and Programming (Procedure and Function)Algorithm and Programming (Procedure and Function)
Algorithm and Programming (Procedure and Function)Adam Mukharil Bachtiar
 
Threshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsThreshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsAleksandr Yampolskiy
 
Refactoring - improving the smell of your code
Refactoring - improving the smell of your codeRefactoring - improving the smell of your code
Refactoring - improving the smell of your codevmandrychenko
 
Quasi Cyclic LDPC codes - Algebraic Construction
Quasi Cyclic LDPC codes - Algebraic Construction Quasi Cyclic LDPC codes - Algebraic Construction
Quasi Cyclic LDPC codes - Algebraic Construction Eapen Vpp
 
Liszt los alamos national laboratory Aug 2011
Liszt los alamos national laboratory Aug 2011Liszt los alamos national laboratory Aug 2011
Liszt los alamos national laboratory Aug 2011Ed Dodds
 

La actualidad más candente (20)

Cs 2003
Cs 2003Cs 2003
Cs 2003
 
Bca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsBca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objects
 
Gate Computer Science Solved Paper 2007
Gate Computer Science Solved Paper 2007 Gate Computer Science Solved Paper 2007
Gate Computer Science Solved Paper 2007
 
20110319 parameterized algorithms_fomin_lecture01-02
20110319 parameterized algorithms_fomin_lecture01-0220110319 parameterized algorithms_fomin_lecture01-02
20110319 parameterized algorithms_fomin_lecture01-02
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17
 
Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...Tutorial: Formal Methods for Hardware Verification - Overview and Application...
Tutorial: Formal Methods for Hardware Verification - Overview and Application...
 
Compile time polymorphism
Compile time polymorphismCompile time polymorphism
Compile time polymorphism
 
Constructor and destructor in C++
Constructor and destructor in C++Constructor and destructor in C++
Constructor and destructor in C++
 
OOP with Java - continued
OOP with Java - continuedOOP with Java - continued
OOP with Java - continued
 
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspe...
 
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve CryptosystemsDiscrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
Discrete Logarithmic Problem- Basis of Elliptic Curve Cryptosystems
 
Algorithm and Programming (Record)
Algorithm and Programming (Record)Algorithm and Programming (Record)
Algorithm and Programming (Record)
 
The what over the how (another way on android development with kotlin)
The what over the how (another way on android development with kotlin)The what over the how (another way on android development with kotlin)
The what over the how (another way on android development with kotlin)
 
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...
Иван Лобов, Data-Centric Alliance, «Текущие тенденции в сфере исследования гл...
 
Algorithm and Programming (Procedure and Function)
Algorithm and Programming (Procedure and Function)Algorithm and Programming (Procedure and Function)
Algorithm and Programming (Procedure and Function)
 
Threshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsThreshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random Permutations
 
Rsa Algorithm
Rsa AlgorithmRsa Algorithm
Rsa Algorithm
 
Refactoring - improving the smell of your code
Refactoring - improving the smell of your codeRefactoring - improving the smell of your code
Refactoring - improving the smell of your code
 
Quasi Cyclic LDPC codes - Algebraic Construction
Quasi Cyclic LDPC codes - Algebraic Construction Quasi Cyclic LDPC codes - Algebraic Construction
Quasi Cyclic LDPC codes - Algebraic Construction
 
Liszt los alamos national laboratory Aug 2011
Liszt los alamos national laboratory Aug 2011Liszt los alamos national laboratory Aug 2011
Liszt los alamos national laboratory Aug 2011
 

Similar a A DSTL to bridge concrete and abstract syntax

An OCL-based bridge from CS to AS
An OCL-based bridge from CS to ASAn OCL-based bridge from CS to AS
An OCL-based bridge from CS to ASUniversity of York
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Taiwan User Group
 
Re-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextRe-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextEdward Willink
 
Lexically constrained decoding for sequence generation using grid beam search
Lexically constrained decoding for sequence generation using grid beam searchLexically constrained decoding for sequence generation using grid beam search
Lexically constrained decoding for sequence generation using grid beam searchSatoru Katsumata
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu WorksZhen Wei
 
DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdfdsfajkh
 
DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright Andrei Alexandrescu
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 Linaro
 
Avito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAvito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAlexey Grigorev
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?Nitay Neeman
 
Bringing Algebraic Semantics to Mahout
Bringing Algebraic Semantics to MahoutBringing Algebraic Semantics to Mahout
Bringing Algebraic Semantics to Mahoutsscdotopen
 
Optimizing with persistent data structures (LLVM Cauldron 2016)
Optimizing with persistent data structures (LLVM Cauldron 2016)Optimizing with persistent data structures (LLVM Cauldron 2016)
Optimizing with persistent data structures (LLVM Cauldron 2016)Igalia
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentationksp4186
 

Similar a A DSTL to bridge concrete and abstract syntax (20)

An OCL-based bridge from CS to AS
An OCL-based bridge from CS to ASAn OCL-based bridge from CS to AS
An OCL-based bridge from CS to AS
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
 
Re-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextRe-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for Xtext
 
Lexically constrained decoding for sequence generation using grid beam search
Lexically constrained decoding for sequence generation using grid beam searchLexically constrained decoding for sequence generation using grid beam search
Lexically constrained decoding for sequence generation using grid beam search
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 
DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdf
 
DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
Avito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAvito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggle
 
Recurrent Instance Segmentation (UPC Reading Group)
Recurrent Instance Segmentation (UPC Reading Group)Recurrent Instance Segmentation (UPC Reading Group)
Recurrent Instance Segmentation (UPC Reading Group)
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?
 
(not= DSL macros)
(not= DSL macros)(not= DSL macros)
(not= DSL macros)
 
Towards hasktorch 1.0
Towards hasktorch 1.0Towards hasktorch 1.0
Towards hasktorch 1.0
 
Introduction to Prolog
Introduction to PrologIntroduction to Prolog
Introduction to Prolog
 
C som-programmeringssprog-bt
C som-programmeringssprog-btC som-programmeringssprog-bt
C som-programmeringssprog-bt
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
 
Cg in Two Pages
Cg in Two PagesCg in Two Pages
Cg in Two Pages
 
Bringing Algebraic Semantics to Mahout
Bringing Algebraic Semantics to MahoutBringing Algebraic Semantics to Mahout
Bringing Algebraic Semantics to Mahout
 
Optimizing with persistent data structures (LLVM Cauldron 2016)
Optimizing with persistent data structures (LLVM Cauldron 2016)Optimizing with persistent data structures (LLVM Cauldron 2016)
Optimizing with persistent data structures (LLVM Cauldron 2016)
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentation
 

Último

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 

Último (20)

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 

A DSTL to bridge concrete and abstract syntax

  • 1. A DSTL To Bridge Concrete and Abstract Syntax Adolfo Sánchez-Barbudo Herrera, Edward D. Willink and Richard F. Paige
  • 2. Agenda ● Scope ● Problem ● Solution ● Comparative Study 2
  • 3. Scope ● Complex Textual Modeling Languages ○ CS is textual (particularly, defined by a grammar) ○ AS is model-based (particularly, defined by a meta-model) ○ Complex Language = AS definition can not be directly inferred from CS definition ● Examples ○ Languages specified by OMG, such as OCL and QVT languages. ○ OCL specification defines the CS via a grammar (Clause 9.3) ○ OCL specification defines the AS via a meta-model (Clause 8) ○ OCL specification describes how to obtain AS from CS (Clause 9.4) 3
  • 4. Agenda ● Scope ● Problem ● Solution ● Comparative Study 4
  • 5. Problem ● Related works (e.g. Xtext) allow to map CS grammars to AS meta-models, but... ● let … in x.y -- an OCL expression ○ ‘y’ is a navigation (i.e. a PropertyCallExp in the AS) ○ ‘x’ ? → It depends on the context y: Property CallExp x: VariableExp ownedSource x: Property CallExp self: VariableExp y: Property CallExp ownedSource ownedSource ‘x’ is a variable name ‘x’ is a property name (i.e self.x.y) 5
  • 6. Problem II CallExpCS: PrimaryExpCS ( ('.' | '->') NameExpCS)* NameExpCS: SimpleNameCS (RoundedBracketClauseCS)? SimpleNameCS: ID; RoundedBracketClauseCS: '(' (ExpCS (',' ExpCS)* )? ')' OCLExpression Operation CallExp Variable Exp Property CallExp Problem: Syntactically, it can not be determined if a simple name corresponds to a PropertyCallExp or VariableExp 6
  • 7. Problem III ● Support to non-simple (i.e. 1-1) CS2AS mappings ○ e.g. a NameExpCS may map to a VariableExp and PropertyCallExp (output pattern) ● Support to cross-references computation ○ e.g. an OCLExpression is a TypedElement: it requires a type cross-reference to be computed ● Name resolution ○ Special case of cross-reference computation ○ e.g. a VariableExp requires to refer to a Variable. ● CS Disambiguation ○ e.g. a NameExpCS may map to either an OperationCallExp, or a PropertyCallExp, or a VariableExp 7
  • 8. Agenda ● Scope ● Problem ● Solution ● Comparative Study 8
  • 10. Solution II ● (External) DSTL to bridge CS and AS (meta-models). ● Why is domain-specific ○ Just one input domain and one output domain (no in-place tx) ○ Specific constructs for name resolution ○ Specific guards semantics for disambiguation rules ● Features: ○ Declarative (M2M) language ○ Resuses Essential OCL as expressions language ○ Currently, four sections ■ helpers ■ mappings ■ disambiguation rules ■ name resolution 10
  • 11. DSTL: Helpers ● To define contextual operations helpers { NameExpCS::parentAsCallExpCS() : CallExpCS = let container = self.oclContainer() in if container.oclIsKindOf(CallExpCS) then container.oclAsType(CallExpCS) else null endif NameExpCS::isNameExpOfACallExpCS() : Boolean = let parentCallExpCS = parentAsCallExpCS() in parentCallExpCS <> null and parentCallExpCS.nameExp = self } body result context 11
  • 12. DSTL: Mappings ● To define mappings between CS and AS (meta-)classes mappings { map PropertyCallExp from NameExpCS when isPropCallExpWithImplicitSource { ownedSource := let referredVar = trace.lookup(Variable, 'self') in VariableExp { referredVariable = referredVar, type = referredVar.type } referredProperty := trace.lookupExported(Property, trace.ownedSource.type, expName), type := trace.referredProperty?.type} } Mapping guard AS property initialization To access AS domain from the CS one Lookup expressions Target AS term Source CS term 12
  • 13. DSTL: Mappings II ● Multi-way mappings (same NameExpCS mapped to different outcomes) mappings { map PropertyCallExp from NameExpCS when isPropCallExpWithImplicitSource { … } map PropertyCallExp from NameExpCS when isPropCallExpWithExplicitSource { … } map OperationCallExp from NameExpCS when isOpCallExpWithExplicitSource { … } map OperationCallExp from NameExpCS when isOpCallExpWithExplicitSource { … } map VariableExp from NameExpCS when isVariableExp { … } } Same source (CS) Different targets (AS) 13
  • 14. DSTL: Disambiguation Rules ● To define disambiguation rules disambiguation { NameExpCS { isOpCallExpWithImplicitSource := roundedBrackets <> null and not isNameExpOfACallExpCS() isOpCallExpWithExplicitSource := roundedBrackets <> null and isNameExpOfACallExpCS() isPropCallExpWithExplicitSource := roundedBrackets = null and isNameExpOfACallExpCS() isVariableExp := … isPropCallExpWithImplicitSource := … } } CS element to disambiguate Disambiguation rule name Boolean-valued expression Important: Order matters 14
  • 15. Name Resolution ● Activity to solve AS cross-references, which involve a name-based lookup ○ From an AS element another named AS element needs to be found in the model. ○ Declaratively, it’s matter of how named elements are contributed to lookup scopes. ○ Scopes are key data structures that keep all visible named element within that scope. ● Scopes: ○ Current Scope ○ Exported Scope ○ Nested Scopes 15
  • 16. Name Resolution II ● Current Scope class C1 { prop p1 : String; op getP1(): String = p1; } : Expression InOCL : Property CallExp class C2 { op getP1() : String = p1; } : Expression InOCL : Property CallExp C1: Class p1: Property getP1: Operation referredProperty C2: Class getP1: Operation referredProperty 16
  • 17. Name Resolution III ● Exported Scope class C1 { prop p1 : String; op getP1(): String = p1; } class C2 { prop c1 : C1; op getP1() : String = c1.p1; } : Expression InOCL : Property CallExp : Expression InOCL : Property CallExp C1: Class p1: Property getP1: Operation referredProperty getP1: Operation referredProperty : Property CallExp referredProperty C2: Class c1: Property 17
  • 18. Name Resolution IV ● Nested Scope (name oclusssion) -- valid expression which -- evaluates to false let v = ‘foo’ in let v = ‘bar’ in v = ‘foo’ ‘foo’: String LiteralExp : LetExp : LetExp v: Variable v: Variable ‘bar’: String LiteralExp ‘foo’: String LiteralExp ‘=’: Operation CallExp : Variable Exp ‘v’ -> Variable (‘foo’) ‘v’ -> Variable (‘bar’)parent nested 18
  • 19. DSTL: Name Resolution ● To define name resolution targets { NamedElement using name; -- ’name’: property used to identify ’targets’ Property; -- ’using’ is optional: extends a fully defined ’target’ element } inputs { SimpleNameCS using name; -- ’name’: property used to match ’targets’ } providers { Class { in current-scope provides occluding ownedProperties; in exported-scope provides ownedProperties; } } 19
  • 20. DSTL: Name Resolution II ● Slightly more complex name resolution providers { Class { in current-scope provides occluding ownedProperties occluding getAllSuperClasses().ownedProperties; in exported-scope provides ownedProperties occluding getAllSuperClasses().ownedProperties; } } 20
  • 21. DSTL: Name Resolution III ● Expressions to perform name-based lookups trace.lookup(Variable, 'self') Kind of target to look up trace.lookupExported(Property,trace.ownedSource.type, expName) The lookup input (a String)Lookup in current scope Lookup in a exported scope Kind of target to look up Actual element providing the exported scope The lookup input (a SimpleNameCS) 21
  • 22. Agenda ● Scope ● Problem ● Solution ● Comparative Study 22
  • 23. Comparative Study: Gra2Mol ● Gra2Mol ○ DSTL can be used for the same purpose: bridging CS and AS syntax ○ Map arbitrary grammars to arbitrary AS meta-models Source Target Nature Query Language Gra2Mol Grammar Terms AS MM Terms Declarative Structure-Shy (Xpath Like) CS2AS DSTL CS MM Terms AS MM Terms Declarative Statically Typed (Essent. OCL) 23
  • 24. Qualitative Study ● Gra2Mol pros: ○ Query Language is more concise (few and effort-saving navigation operators) ○ Provides a language extensibility mechanism ● CS2AS DSTL pros: ○ OCL has more expressive power (beyond simple model navigation) ○ AS model can be navigated (Gra2Mol QL only operates at CS level) ○ No coupling with a parsing technology ○ Declarative name resolution section saves encoding lookup algorithms ■ to resolve name-based cross-references ○ Ordering-based disambiguation rules description ■ to overcome their admitted limitation of having to define exclusive rule guards. 24
  • 25. Quantitative Study: Example company : ’company’ STRING ’{’ department* ’}’ EOF; department : ’department’ STRING ’{’ department_manager department_employees department* ’}’; department_manager : ’manager’ employee; department_employees : (’employee’ employee)*; employee : STRING ’{’ ’address’ STRING ’salary’ FLOAT (’mentor’ STRING)? ’}’; 25
  • 26. Quantitative Study: Gra2Mol rule 'mapDepartment' from department d to Department queries mElem : /d/department_manager/#employee; eElem : /d/department_employees/#employee; dElem : /d/#department; mappings name = removeQuotes d.STRING; manager = mElem; employees = eElem; subdepts = dElem; end_rule 26
  • 27. Quantitative Study: CS2AS DSTL mappings { map Department from department { name := name; manager := department_manager.employee.trace; employees := department_employees.employee.trace; subdepts := deparment.trace; } } 27
  • 28. Quantitative Study: Inputs Generator ● Nd: No of (top level) departments ● Ns: No of subdeparments ○ per departement/subdepartment ● Ne: No of employees ○ per departement/subdepartment ● Ds: Depth level of (sub)departments ID Size (bytes) Elements Nd Ns Ne Ds 1 1,238 22 3 0 3 1 2 6,105 97 3 3 4 2 3 149,951 701 1 1 3 100 4 42,805 708 1 100 3 2 5 223,848 3061 4 4 5 4 6 1,018,254 11901 10 4 10 4 7 9,794,276 109341 10 5 10 5 28
  • 29. Quantitative Study: Results ● CS2AS tx execution measured ● Overall: 10-fold improvement ● Input topology does not impact to our solution 29
  • 30. Thanks you very much !!!! asbh500@york.ac.uk / me@adolfosbh.co @adolfosbh Questions ? 30