Download presentation

Presentation is loading. Please wait.

Published byHilda Lewis Modified over 3 years ago

1
Formalizing Homogeneous Language Embeddings Tony Clark Centre for Model Driven Software Engineering, School of Computing, Thames Valley University tony.clark@tvu.ac.uk http://itcentre.tvu.ac.uk/~clark/ Laurence Tratt School of Design Engineering and Computing, Bournemouth University laurie@tratt.net http://tratt.net/laurie/ 1

2
Overview Language Factories and DSLs An example and some properties A language model for DSLs The mu-calculus for DSLs Some examples Further work. 2

3
Language Factories The ability to construct new languages by combining precisely defined, reusable, language components and templates. 3

4
Language Component A B C D E σσσσσ Abstract Syntax Tree Execution Trace program A block B do C do D end do E end parse 4

5
Problem Addressed Parametric Language Component Reusable Language Component Questions: how can syntax be merged? how can semantics be merged? how can we specify the combination? 5

6
An Application of DSLs let results = lang sql:SQL[ select name,age from Customer where age > 18] in lang html:HTML[ for name,age in results do name age ] 6

7
A B C E V W X Y Z σσσσσ σ load unload host language(G) embedded language(H) A Model for DSL Embedding evalH evalG 7

8
The mu-Calculus E ::= V variables | fun(V) E functions | E E applications | (E,E,E) language def | lang E:T[C] language embed |... 8

9
Abstract Syntax type Exp(T) = Var(String) | Lambda(String,Exp(T)) | Apply(Exp(T),Exp(T)) | (Exp(T),Exp(T),Exp(T)) | Lang(T) |... 9

10
Semantics evalExp(eval)(s) = case s of... standard SECD except for... (R:():s,e,App:c,d) -> eval((s,e,c,d):s,e,c,d) (I:v:s,e,App:c,d) -> eval(v) end 10

11
Loading and Unloading lang(eval,load,unload):t[c] is equivalent to: I(newState) where newState = unload(termState,initialState) where termState = eval(startState) where startState = load(initialState,parse(t)(c)) where initialState = R() reify the host state translate host state to embedded initial state produce embedded terminal state translate terminal embedded to host state install the host state 11

12
mu-calculus Embedded in Itself Mu = Y(Exp) evalMu = Y(evalExp) loadMu((s,e,c,d),x) = (s,e,x:s,d) unloadMu(s,_) = s muL = (evalMu,loadMu,unloadMu) fun(x) lang muL:Mu[ fun(y) lang muL:Mu[x + y]] 12

13
Let Binding: Semantics type LetExp(T) = Let(String,Let(T),Let(T)) | Exp(T) type Let = Y(LetExp) evalLetExp(eval)(s) = case s of (s,e,Let(n,x,b):c,d) -> eval(s,e,x:Let(n,b):c,d) (v:s,e,Let(n,b):c,d) -> eval([],e[n->v],[b],(s,e,c,d)) else evalExp(eval)(s) end 13

14
Let-Binding: Language Definition type Let = Y(LetExp) evalLet = Y(evalLetExp) loadLet((s,e,c,d),x) = (s,e,x:c,d) unoadLet(s,_) = s letL = (evalLet,loadLet,unloadLet) fun(x) lang letL:Let[ let y = x + 1 in y ] 14

15
Other Examples lang letL:Let[ let mkArray = fun(limit) lang arrayL:Array [ 0.. limit ] in mkArray(100)] lang letL:Let[ let x =... in lang abortL:Abort[ stop if(x > 100) ]] 15

16
Review and Further Work mu-Calculus for semantic analysis of language embedding. Further work: –Parsing –Static Analysis –Logic for combining language components –Practical considerations 16

Similar presentations

OK

Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)

Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on indian culture download Ppt on different types of dance forms renaissance Best ppt on ozone layer Pituitary gland anatomy and physiology ppt on cells Ppt on thermal power plant in india Ppt on power line carrier communication pdf Ppt on statistics in maths what does the range Ppt on marketing management project Ppt on western culture vs indian culture Ppt on matrix organizational structure