BiFluX: A Bidirectional Functional Update Language for XML
Hugo Pacheco
Joint work with Tao Zan and Zhenjiang Hu
National Institute of Informatics, Tokyo, Japan
BiFluX: A Bidirectional Functional Update Language for XML Hugo - - PowerPoint PPT Presentation
BiFluX: A Bidirectional Functional Update Language for XML Hugo Pacheco Joint work with Tao Zan and Zhenjiang Hu National Institute of Informatics, Tokyo, Japan BiG Camp Karuizawa September 3rd, 2013 BXs and Lenses lenses are one of
National Institute of Informatics, Tokyo, Japan
S S V V
get put
s' s v'
put get
s v
get put
S V
get
V S
put derive
S V S V
get put
get 4 4 4
put1 2 2 4
put2 2 2 2
“Putback” is the Essence of Bidirectional Programming GRACE-TR 2012-08, GRACE Center, National Institute of Informatics, December 2012.
Combinators for “Putback” Style Bidirectional Programming Technical report, July 2013, Submitted. S V
get
V S
put derive
S V S V
get put
S V
get put
V S
Put ::= id | Put ◦< Put
| Φ p | bot p
| effect f Put
| Prod | Sum | Cond | Iso | Rec Prod ::= addfst f | addsnd f | keepfstOr | keepsndOr | copy
| remfst f | remsnd f
| Put ⊗ Put
Sum ::= inj p | injsOr | injl | injr
| Put ∇ Put | Put ∇p Put | Put • ∇ Put | Put • ∇ Put
| uninjl | uninjr
| Put + Put
Cond ::= ifthenelse | ifVthenelse | ifSthenelse
Iso ::= swap | assocl | assocr
| coswap | coassocl | coassocr
| distl | distr
Rec ::= in | out
S U V
V
get put
V S S
s ... ... s' ... ...
s ... ... v
ucast
dcast
s a b a a c s a b a a c b b b
s : S s' : S s'' : S v1 : V1 v2 : V2
t : T t' : T' t'' : T''
s1 : S1 s1' : S1 v : V s : S s' : S s : S s' : S v1 : V1 v : V
S T V expr T <: S s : S t : T () : () s' : S T <: S u
a1 a2 b1 b2 b3 b1 b2 b3
source a a a view a $v source a a a
Stmt ::= Upd [WHERE Expr] | IF Expr THEN Stmt ELSE Stmt | | Stmt ; Stmt | { Stmt } | LET Pat = Expr IN Stmt | CASE Expr OF { Cases } Upd ::= INSERT (BEFORE | AFTER) Path VALUE Expr | INSERT AS (FIRST | LAST) INTO Path VALUE Expr | DELETE [FROM] Path | REPLACE [IN] Path WITH Expr | UPDATE Path BY Stmt | UPDATE Path BY VStmt FOR VIEW Path [Match] | KEEP Path AS (FIRST | LAST) | CREATE VALUE Expr Cases ::= Pat → Stmt | Cases ′|′ Cases VStmt ::= VUpd ′|′ VUpd | VUpd VUpd ::= MATCH → Stmt | UNMATCHS → Stmt | UNMATCHV → Stmt Match ::= MATCHING BY Path | MATCHING SOURCE BY Path VIEW BY Path Path ::= . . . Pat ::= . . . Expr ::= . . .