Coupled Transformations of SPPFs Dr. Vadim Zaytsev aka - - PowerPoint PPT Presentation

coupled transformations of sppfs
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Coupled Transformations

  • f SPPFs
  • Dr. Vadim Zaytsev aka @grammarware

GCM @ STAF 2015

slide-2
SLIDE 2
slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5

Grammars

✓ Finite language definitions ✓ Text biased ✓ Tree biased ✓ Can be
 generalised

http://rikiji.it/2010/06/21/compilers.html

slide-6
SLIDE 6

Grammars ⇒ Trees

E ::= E "+" E; E ::= "x" | "y";

E E E + y x

slide-7
SLIDE 7

E E E + y x

Grammars ⇒ Trees

E ::= E "+" E; E ::= "x" | "y";

E E + x

slide-8
SLIDE 8

E E E + y x

Grammars ⇒ Trees

E E + x

E E E + x y E E + x

OR

slide-9
SLIDE 9

E E E + y x

Grammars ⇒ Trees

E E + x

E E E + x y E E + x

AND

generalised parsing

slide-10
SLIDE 10

E E E E E + y x

Grammars ⇒ Graphs

+

generalised parse

E x E

slide-11
SLIDE 11

SPPF

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

  • he1, (e2, t6, t7)i, he1, (e4, t4, e6)i, he1, (t1, t2, e3)i,

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

slide-12
SLIDE 12

E ::= ABC & AB c+ & a+ BC; ABC ::= a+ b+ c+ AB ::= a AB? b; BC ::= b AB? c;

Boolean grammars

a b c a+ AB b+ BC c+ S S S AB? ε BC? ε ABC

nice parse view context-sensitivity trick

slide-13
SLIDE 13

The real problem: transformation

slide-14
SLIDE 14

The real problem:

✓ Manipulate “nice” views ✓ let the rest keep up ✓ Merge views ✓ disambiguate ✓ Modular transformations ✓ temporary inconsistencies ✓ Many solutions ✓ none satisfactory ✓ Standing challenge

slide-15
SLIDE 15

State of the art [grammars]

XBGF ΞBGF SLEIR . . .

http://grammarware.github.io/lab/

slide-16
SLIDE 16

This paper coupled transformation grammars SPPFs

slide-17
SLIDE 17

extract

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)

slide-18
SLIDE 18

fold

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+

slide-19
SLIDE 19

inline

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? ε

slide-20
SLIDE 20

Solution (graphs)

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

slide-21
SLIDE 21

Conclusion

✓ 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?

slide-22
SLIDE 22

Questions? Suggestions?

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