Are functional languages a good way to represent productive meta models?

Similar documents
Introduction to Functional Programming and basic Lisp

by the evening of Tuesday, Feb 6

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

Principles of Programming Languages 2017W, Functional Programming

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

Web Services Composition: Mashups Driven Orchestration Definition

Spring 2018 Discussion 7: March 21, Introduction. 2 Primitives

Common LISP Tutorial 1 (Basic)

Fall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives

An MDD Process for IEC based Industrial Automation Systems

Announcements. Today s Menu

Introduction to LISP. York University Department of Computer Science and Engineering. York University- CSE V.

Chapter 1. Fundamentals of Higher Order Programming

Orchestration Evolution & Dataflow Concepts:

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

A Small Interpreted Language

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives

Announcement. Overview. LISP: A Quick Overview. Outline of Writing and Running Lisp.

Introduction to MDE and Model Transformation

Common LISP-Introduction

Functions, Conditionals & Predicates

Lisp Basic Example Test Questions

Homework 1. Reading. Problems. Handout 3 CSCI 334: Spring, 2012

LECTURE 16. Functional Programming

Clojure. The Revenge of Data. by Vjeran Marcinko Kapsch CarrierCom

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

FEASIBILITY of the MDA APPROACH in UCE projects

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

ACSL All-Star Practice

Lambda Calculus and Lambda notation in Lisp II. Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky.

Scheme. Functional Programming. Lambda Calculus. CSC 4101: Programming Languages 1. Textbook, Sections , 13.7

15 Unification and Embedded Languages in Lisp

Model-Based Techniques in the Development of Net-Centric Applications. Timothy A. Anderson Basil C. Krikeles. June 20, 2007

Computation Independent Model (CIM): Platform Independent Model (PIM): Platform Specific Model (PSM): Implementation Specific Model (ISM):

Model Driven Engineering (MDE)

a little more on macros sort of like functions, but..

OASIS BPEL Webinar: Frank Leymann Input

Environments

CPS 506 Comparative Programming Languages. Programming Language Paradigm

BIG MODELS AN ALTERNATIVE APPROACH

SCHEME The Scheme Interpreter. 2 Primitives COMPUTER SCIENCE 61A. October 29th, 2012

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters

CSCI337 Organisation of Programming Languages LISP

Network Programmability with Cisco Application Centric Infrastructure

;; definition of function, fun, that adds 7 to the input (define fun (lambda (x) (+ x 7)))

Symbolic Computation and Common Lisp

Principles of Programming Languages Topic: Functional Programming Professor L. Thorne McCarty Spring 2003

Model-Driven Design of Interoperable Agents

Functional programming with Common Lisp

Transforming Collaborative Process Models into Interface Process Models by Applying an MDA Approach

A Brief Introduction to Common Lisp

Functional Programming. Pure Functional Programming

Model Querying with Graphical Notation of QVT Relations

innoq Deutschland GmbH innoq Schweiz GmbH D Ratingen CH-6330 Cham Tel Tel

Implementing languages on the Erlang VM

Language engineering and Domain Specific Languages

SOFTWARE ARCHITECTURE 6. LISP

DSV Library for Lisp

2nd Belgian-Dutch workshop on Software Evolution

Evaluating Scheme Expressions

Documentation for LISP in BASIC

Functional Programming. Big Picture. Design of Programming Languages

Debugging in LISP. trace causes a trace to be printed for a function when it is called

6.037 Lecture 4. Interpretation. What is an interpreter? Why do we need an interpreter? Stages of an interpreter. Role of each part of the interpreter

COMMOM OBJECT ORIENTED LISP SYSTEMS

Announcements. The current topic: Scheme. Review: BST functions. Review: Representing trees in Scheme. Reminder: Lab 2 is due on Monday at 10:30 am.

Wikileaking Eclipse Modeling - Spilling the beans on how industry uses EMF based tooling successfully! Ronan Barrett, Ericsson

Model Driven Architecture - The Vision

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

Kony and TIBCO enable fast reliable Websockets Communication. Overview of the integration of WebSockets with TIBCO eftl and the Kony Platform

Functional Programming and the Web

Robot Programming with Lisp

= {A Model-Driven Approach to. Implementing Coordination Protocols in BPEL

Topic III. LISP : functions, recursion, and lists References: Chapter 3 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

Intro. Scheme Basics. scm> 5 5. scm>

CS A331 Programming Language Concepts

Fall 2017 Programming Project #5 Databases CMSC 420 Hanan Samet

Model Driven Service Interoperability through use of Semantic Annotations

Lisp: Question 1. Dr. Zoran Duric () Midterm Review 1 1/ 13 September 23, / 13

LISP Programming. (23 (this is easy) hello 821)

Recursive Functions of Symbolic Expressions and Their Computation by Machine Part I

Introduction to Functional Programming

Emacs: Editing, Writing and Programming

A Mashup-Based Strategy for Migration to Web 2.0

Raising the Level of Development: Models, Architectures, Programs

FP Foundations, Scheme

Emacs Lisp Introduction

* Corresponding Author

Calculating Correct Compilers

Heap storage. Dynamic allocation and stacks are generally incompatible.

Review of Functional Programming

Overview of lectures today and Wednesday

Practical Model-Driven Development with the IBM Software Development Platform

APT Session 6: Compilers

Basics of Using Lisp! Gunnar Gotshalks! BLU-1

Accurate Step Counting

AUTOMATED BEHAVIOUR REFINEMENT USING INTERACTION PATTERNS

Common Lisp. Blake McBride

CS 314 Principles of Programming Languages

Transcription:

Are functional languages a good way to represent productive meta models? Rainbow Team, I3S Lab, CNRS University of Nice, France http://rainbow.i3s.unice.fr 4 th European Lisp Workshop ECOOP 07, 07/30/2007, Berlin, Germany

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 2

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 3

... in a (not so) far away community Model Driven Development Work on models & meta model Different levels of abstraction Towards productivity From independance (Pim) to specificity (Psm) or technological domains bridges Keystone : Model Transformations 4

Example : CommonLisp programs Meta Model : Lisp language Pim 1 : Lisp program Psm 2 : Executable code ( defun fac (n) (if (= n 1) n (* n ( fac (- n 1))))) 1 Platform Independent Model 2 Platform Specific Model 5

Challenges Model transformations Atl : Pattern selection Kermeta : Mop... Productivity : Push the button! But you need such a button! Define meta models Define languages syntax Express translations Express transformations... 6

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 7

ADORE : Aspects & Distributed ORchEstrations Web Services Set of norms & protocols (Http, Soap, Xml,... ) Expose atomic business code in an interoperable way Web Services Orchestrations Bounded language to express collaborations between services An orchestration is a Web Service ADORE Challenges Cope with unexpected evolutions of systems Merge Orchestrations on demand http://rainbow.i3s.unice.fr/adore 8

Illustration : An enterprise network 9

Illustration : Some Orchestrations 10

Illustration : Unexpected evolution 11

The approach : a logic based merge engine 12

Models, tools & platforms Languages : Bpel Boa Merge : Prolog Execution : C# Display : GraphViz... Keystone : Omsm 13

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 14

Challenges about Model Transformations User : Dsl as entry point Model???? black box Developer : Meta Model as entry point Dsl to express model white box In a nutshell... User doesn t want to know how system works! Developer wants to know : How can I express transformations? How should models looks like? How can I reach multiple targets? Compile once, transform everywhere! 15

Possible solutions Do it by hand! Use existing tools Use a simple approach each times... cf. doc p.743 Tree driven evaluation 16

Let s go using Lisp 1 Dsl Lisp : Compilation 2 A transformation A set of functions 3 Model Transformation Evaluation 17

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 18

A simple Meta Model : Arithmetic Binary Expressions 19

A simple Dsl : Arithmetic Binary Expressions ROOT ::= < EXPR > EXPR ::= 0 [1 9] + [0 9] ( < EXPR > ) < EXPR > + < EXPR > < EXPR > < EXPR > < EXPR > < EXPR > < EXPR > / < EXPR > 20

Model Example : an expression Dsl representation : e = ((20 + 32) (5 4))/2 Uml representation : 21

Model transformations targets Language Concrete Syntax describing e dc dc -e "20 32 + 5 4 * - 2 / p" Lisp (format t "~a~%" (/ (- (+ 20 32) (* 5 4)) 2)) Python print ((20+32) - (5*4)) / 2 e = (20 + 32) (5 4) 2 22

Transformation algorithm Compilation : from Dsl to s expr ( setq e ( quote ( root ( divide ( minus ( plus 20 32) ( star 5 4)) 2)))) Another model representation! Model transformation : read, eval, execute! ( defun transform ( model functions ) ( load functions ) ( eval model )) 23

Lisp transformation Transformation definition ( defun root ( exp ) ( format nil " ~a = ~a" exp ( eval exp ))) ( defun divide (a b) ( list ( quote /) a b)) ( defun minus (a b) ( list ( quote -) a b)) ( defun plus (a b) ( list ( quote +) a b)) ( defun star (a b) ( list ( quote *) a b)) Transformation session [1] > ( load " transfo.l") ;; Loading file transfo.l... ;; Loaded file transfo. l T [2] > ( transform e " lisp.l") ;; Loading file lisp.l... ;; Loaded file lisp. l "(/ (- (+ 20 32) (* 5 4)) 2) = 16" [3] > ( exit ) 24

Dc transformation Transformation definition ( defun root ( exp ) ( format nil "dc -e \"~ a p\"" exp )) ( defun divide (a b) ( format nil "~a ~a /" a b)) ( defun minus (a b) ( format nil "~a ~a -" a b)) ( defun plus (a b) ( format nil "~a ~a +" a b)) ( defun star (a b) ( format nil "~a ~a *" a b)) Transformation session [1] > ( load " transfo.l") ;; Loading file transfo.l... ;; Loaded file transfo. l T [2] > ( transform e "dc.l") ;; Loading file dc.l... ;; Loaded file dc. l "dc -e \"20 32 + 5 4 * - 2 / p\"" [3] > ( exit ) 25

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 26

ADORE entry point : abstract Orchestration pattern A simple Dsl expressing behaviour more elegant than Xml based verbose dialects pattern AddPartner { partner InfoProvider, NewService rule InfoProvider :: GetInformations -> { var legacy, newl, result as adore : list } } ( legacy <- proceed () // newl <- NewService :: GetNewInformations () ) ; result <- Concat ( legacy, newl ); reply result 27

./boac.sh -i docs/addpartner.boa -t scheme ( pattern AddPartner ( partners ( list InfoProvider NewService )) ( rules ( list ( rule ( target InfoProvider " GetInformations ") ( variables ( list ( variable legacy ;;... ))) ( instructions ( list ( instruction i236 ( list boa : proceed ( list )) ( inputs ( list )) ( outputs ( list ( ref_var (;;...)))) ( conditions ( list ))) ;;...)) ( orders ( list ( order i236 i238 ) ;;... )))))) 28

./boac.sh -i docs/addpartner.boa -t graphviz ( define ( partners L) ( let * ((s ( apply string- append ( map ( lambda (e) ( format "~a " e)) L ))) (l ( string-length s)) (ps ( substring s 0 (if (= 0 l) 0 (- l 1))))) ( format " partners... \"{ Name ~a}\" ;" ps )))

./boac.sh -i docs/addpartner.boa -t...

Outline 1 Once upon a time... 2 The ADORE project, part I 3 About models transformations 4 Proof of concept : Arithmetic Expressions 5 The ADORE project, part II 6... They lived happily ever after 31

Summary : Today, we have seen,... How s exprs can represent models How evaluation sounds like transformation How it works : on a proof of concept on a real application 32

Open questions How about performances & scalability? How about evaluation order? How about model evolutions & tracability? 33

... They lived happily ever after Object Oriented languages foundations come from Lisp : Clos, Mop, Dynamic typing,... Model Driven Development comes from the Object World Functional languages can express MDD concepts Let s fill the gap! Questions? Remarks? 34