Coupled Transformations
- f SPPFs
- Dr. Vadim Zaytsev aka @grammarware
Coupled Transformations of SPPFs Dr. Vadim Zaytsev aka - - PowerPoint PPT Presentation
Coupled Transformations of SPPFs Dr. Vadim Zaytsev aka @grammarware GCM @ STAF 2015 Grammars Finite language definitions Text biased Tree biased Can be generalised http://rikiji.it/2010/06/21/compilers.html Grammars
✓ Finite language definitions ✓ Text biased ✓ Tree biased ✓ Can be generalised
http://rikiji.it/2010/06/21/compilers.html
E ::= E "+" E; E ::= "x" | "y";
E E E + y x
E E E + y x
E ::= E "+" E; E ::= "x" | "y";
E E + x
E E E + y x
E E + x
E E E + x y E E + x
E E E + y x
E E + x
E E E + x y E E + x
generalised parsing
E E E E E + y x
+
generalised parse
E x E
E E 2 + 2 + 2 E E + 2 E E E E E E
e1 e2 e3 e
4
e
5
e
6
t1 t2 t3 t4 t5 t6 t7
he2, (e4, t4, t5)i, he2, (t1, t2, e5)i, he3, (e5, t6, t7)i, he3, (t3, t4, e6)i, he4, (t1, t2, t3)i, he5, (t3, t4, t5)i, he6, (t5, t6, t7)i
E ::= ABC & AB c+ & a+ BC; ABC ::= a+ b+ c+ AB ::= a AB? b; BC ::= b AB? c;
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε ABC
nice parse view context-sensitivity trick
✓ Manipulate “nice” views ✓ let the rest keep up ✓ Merge views ✓ disambiguate ✓ Modular transformations ✓ temporary inconsistencies ✓ Many solutions ✓ none satisfactory ✓ Standing challenge
http://grammarware.github.io/lab/
S ::= a+ b+ c+ & AB c+ & a+ BC; AB ::= a AB? b; BC ::= b BC? c;
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε
(a)
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε ABP a b c AP AB b+ BC c+ S S S AB? ε BC? ε a+
S ::= AP b+ c+ & AB c+ & AP BC; AB ::= a AB? b; BC ::= b BC? c; AP ::= a+; S ::= ABP c+ & AB c+ & a+ BC; AB ::= a AB? b; BC ::= b BC? c; ABP ::= a+ b+;
(b) (c)
S ::= ABC & AB c+ & AP BC; AB ::= a AB? b; BC ::= b BC? c; ABC ::= a+ b+ c+; AP ::= a+;
a b c AP AB b+ BC c+ S S S AB? ε BC? ε ABC a+
S ::= ABC & AB c+ & a+ BC; AB ::= a AB? b; BC ::= b BC? c; ABC ::= a+ b+ c+; AP ::= a+;
(a) (b)
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε ABC
(c)
S ::= ABC & AB c+ & AP BC; AB ::= a AB? b; BC ::= b BC? c; ABC ::= AP b+ c+; AP ::= a+;
a b c AP AB b+ BC c+ S S S AB? ε BC? ε ABC a+
S ::= ABC & AB c+ & a+ BC; AB ::= a AB? b; BC ::= b BC? c; ABC ::= a+ b+ c+;
(a) (b)
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε ABC
S ::= a+ b+ c+ & AB c+ & a+ BC; AB ::= a AB? b; BC ::= b BC? c;
a b c a+ AB b+ BC c+ S S S AB? ε BC? ε
Language SPPFs Examples preserved preserved introduce, unlabel preserved refactored fold, inline extended preserved addV, define extended refactored removeC, widen reduced preserved? removeV, undefine reduced refactored disappear reduced refactored? addC, narrow revised refactored permute, renameT revised refactored? redefine, replace revised — inject
✓ Programmably cotransform ✓ string/term grammars ✓ forest representations ✓ Applicable to grammars in a broad sense ✓ views and models with uncertainty ✓ Still unclear ✓ What is the best way? ✓ Formalisation?
E E 2 + 2 + 2 E E + 2 E E E E E E
e1 e2 e3 e
4
e
5
e
6
t1 t2 t3 t4 t5 t6 t7