PLILP/ALP ’98 - 1 -
Architecturing Software Using a Methodology for Language Development
Charles Consel
Compose Group IRISA / University of Rennes 1 - INRIA
October 1998
Architecturing Software Using a Methodology for Language - - PowerPoint PPT Presentation
Architecturing Software Using a Methodology for Language Development Charles Consel Compose Group IRISA / University of Rennes 1 - INRIA October 1998
PLILP/ALP ’98 - 1 -
October 1998
PLILP/ALP ’98 - 2 -
PLILP/ALP ’98 - 3 -
PLILP/ALP ’98 - 4 -
PLILP/ALP ’98 - 5 -
PLILP/ALP ’98 - 6 -
PLILP/ALP ’98 - 7 -
PLILP/ALP ’98 - 8 -
PLILP/ALP ’98 - 9 -
PLILP/ALP ’98 - 10 -
PLILP/ALP ’98 - 11 -
PLILP/ALP ’98 - 12 -
PLILP/ALP ’98 - 13 -
PLILP/ALP ’98 - 14 -
PLILP/ALP ’98 - 15 -
PLILP/ALP ’98 - 16 -
➨ Systematic re-use.
PLILP/ALP ’98 - 17 -
PLILP/ALP ’98 - 18 -
PLILP/ALP ’98 - 19 -
PLILP/ALP ’98 - 20 -
➨
PLILP/ALP ’98 - 21 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 22 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 23 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 24 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
– actions – verifications
PLILP/ALP ’98 - 25 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 26 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
based on the dynamic semantic algebras
PLILP/ALP ’98 - 27 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 28 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
PLILP/ALP ’98 - 29 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Program family DSL compiler
– flexible – efficient
PLILP/ALP ’98 - 30 -
PLILP/ALP ’98 - 31 -
◆ Inspired by mh/slocal, Unix mail delivery tool.
PLILP/ALP ’98 - 32 -
Interface definition Program family
PLILP/ALP ’98 - 33 -
◆ ◆
◆ ◆
Interface definition Program family
PLILP/ALP ’98 - 34 -
◆ ◆ ◆ ◆ ◆
Interface definition Program family
PLILP/ALP ’98 - 35 -
◆ ⇒
◆
Interface definition Program family
PLILP/ALP ’98 - 36 -
◆ ◆
– – →→ –
◆ ◆
– →× – →→
Language analysis Staged semantics
PLILP/ALP ’98 - 37 -
= match | not | and | or = ; | if then else | skip | delete | copy | forward | reply | pipe
∈ ∈ ∈ ∈ move ≡ copy ; delete if then ≡ if then else skip
Language analysis Staged semantics
PLILP/ALP ’98 - 38 -
if match “Subject” “DSL” then forward “jake”; move Research.Lang.DSL else if match “From” “hotmail.com” then reply “Leave me alone!”; delete else if match “Subject” “seminar” then pipe “agenda --stdin”; delete
Language analysis Staged semantics
PLILP/ALP ’98 - 39 -
the compiler Determine member of program family Configure generic software
Produce answer for a family member Execute customized software
➨ Reason about genericity: predict/control customisation.
Interface definitions Formal definition
PLILP/ALP ’98 - 40 -
◆ ◆
◆ ◆
◆ ◆
Formal definition Interface definitions
PLILP/ALP ’98 - 41 -
◆
◆ ◆
◆
Staged semantics Abstract machine
PLILP/ALP ’98 - 42 -
→→→ [[copy ]] ρ σ = let ν = ( [[ ]]) ρfolder-hierarchy
ϕ = ( “Delivery-Date” σdate σmessage)
( ν σfolder-files) in [folder-files ν ϕ σfolder-files] σ →→ [[match ]] σ = ( ( [[]]) σmessage) ( [[]])
Staged semantics Abstract machine
PLILP/ALP ’98 - 43 -
Formal definition Implementation
PLILP/ALP ’98 - 44 -
◆
◆
Implementation
PLILP/ALP ’98 - 45 -
→→→ [[copy ]] ρ σ = let ν = get-filename ( [[ ]]) ρfolder-hierarchy in ((write-folderν) (add-msg) (set-field“Delivery-Date” σdate) (read-folderν)) σ
Formal definition Implementation
PLILP/ALP ’98 - 46 -
Abstract machine Partial evaluation
PLILP/ALP ’98 - 47 -
◆ ◆
Abstract machine Partial evaluation
PLILP/ALP ’98 - 48 -
Program Output
Input DSL Program
Abstract Machine Program
Compiled DSL Program Input Output
Abstract machine Partial evaluation
PLILP/ALP ’98 - 49 -
cond (match (get-field “Subject”) “DSL”) (new-msg; set-field “Date” (date) set-field “To” “jake”; set-field “From” “bob”; set-body (msg-to-string); set-field “Subject” (concat “Fwd: ” (get-field “Subject”)); set-field “Resent-by” (concat “bob” (get-field “Resent-by”)); send-msg; ... if match “Subject” “DSL” then forward “jake”; ...
Implementation DSL compiler
PLILP/ALP ’98 - 50 -
Implementation DSL compiler
PLILP/ALP ’98 - 51 -
PLILP/ALP ’98 - 52 -
PLILP/ALP ’98 - 53 -
PLILP/ALP ’98 - 54 -
PLILP/ALP ’98 - 55 -
Input DSL Program
Abstract Machine Program
Compiled DSL Program
Implementation DSL compiler
PLILP/ALP ’98 - 56 -
[[if then else ]] ρ = ( [[]]) ([[]] ρ) ( [[]] ρ) [[pipe ]] ρ σ = [cmd-stream σmessage ( [[]]) σcmd-stream] σ
PLILP/ALP ’98 - 57 -
PLILP/ALP ’98 - 58 -
PLILP/ALP ’98 - 59 -
PLILP/ALP ’98 - 60 -
Program Output
Input DSL Program
Abstract Machine Program
Compiled DSL Program Input Output
PLILP/ALP ’98 - 61 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family
semantic algebras.
DSL compiler
PLILP/ALP ’98 - 62 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
Domain Knowledge.
PLILP/ALP ’98 - 63 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
Domain knowledge: – Technical literature. – Existing programs. – Current and future requirements. – Common patterns and variations.
PLILP/ALP ’98 - 64 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 65 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
– syntactic constructs – the objects and operations
PLILP/ALP ’98 - 66 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 67 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 68 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 69 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 70 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
PLILP/ALP ’98 - 71 -
Language analysis Interface definition Staged semantics Formal definition Abstract machine Implementation Partial evaluation Problem family DSL compiler
– efficient – flexible