coupled transformations of sppfs
play

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


  1. Coupled Transformations of SPPFs Dr. Vadim Zaytsev aka @grammarware GCM @ STAF 2015

  2. Grammars ✓ Finite language definitions ✓ Text biased ✓ Tree biased ✓ Can be 
 generalised http://rikiji.it/2010/06/21/compilers.html

  3. Grammars ⇒ Trees E E ::= E "+" E; E + E E ::= "x" | "y"; x y

  4. Grammars ⇒ Trees E E ::= E "+" E; E + E E ::= "x" | "y"; E + E x x y

  5. Grammars ⇒ Trees E E OR E + E E + E x E + E y x E + E x x y

  6. Grammars ⇒ Trees E E AND E + E E + E x E + E y x E + E x x y generalised parsing

  7. Grammars ⇒ Graphs generalised E E parse E E E + E + E x y x

  8. SPPF e 1 E E E e 2 e 3 E E E E e 5 e e E E E 4 6 2 + 2 + 2 + 2 t 1 t 2 t 3 t 4 t 5 t 6 t 7 � h e 1 , ( e 2 , t 6 , t 7 ) i , h e 1 , ( e 4 , t 4 , e 6 ) i , h e 1 , ( t 1 , t 2 , e 3 ) i , h e 2 , ( e 4 , t 4 , t 5 ) i , h e 2 , ( t 1 , t 2 , e 5 ) i , h e 3 , ( e 5 , t 6 , t 7 ) i , h e 3 , ( t 3 , t 4 , e 6 ) i , h e 4 , ( t 1 , t 2 , t 3 ) i , h e 5 , ( t 3 , t 4 , t 5 ) i , h e 6 , ( t 5 , t 6 , t 7 ) i

  9. Boolean grammars S S S E ::= ABC nice parse view & AB c+ ABC & a+ BC; a+ AB b+ BC c+ ABC ::= a+ b+ c+ AB ::= a AB? b; BC ::= b AB? c; AB? BC? context-sensitivity trick a b c ε ε

  10. The real problem: transformation

  11. The real problem: ✓ Manipulate “nice” views ✓ let the rest keep up ✓ Merge views ✓ disambiguate ✓ Modular transformations ✓ temporary inconsistencies ✓ Many solutions ✓ none satisfactory ✓ Standing challenge

  12. State of the art [grammars] XBGF Ξ BGF . . . SLEIR http://grammarware.github.io/lab/

  13. This paper coupled transformation grammars SPPFs

  14. extract S S S S S S S S S ABP a+ AB b+ BC c+ AP AB b+ BC c+ a+ AB b+ BC c+ a+ AB? BC? AB? BC? AB? BC? a b c a b c a b c ε ε ε ε ε ε S ::= a+ b+ c+ & AB c+ & a+ BC; S ::= AP b+ c+ & AB c+ & AP BC; S ::= ABP c+ & AB c+ & a+ BC; AB ::= a AB? b; AB ::= a AB? b; AB ::= a AB? b; BC ::= b BC? c; BC ::= b BC? c; BC ::= b BC? c; AP ::= a+; ABP ::= a+ b+; (a) (b) (c)

  15. fold S S S S S S S S S ABC AP ABC ABC a+ AB b+ BC c+ a+ AB b+ BC c+ AP AB b+ BC c+ a+ AB? BC? AB? BC? AB? BC? a b c a b c a b c ε ε ε ε ε ε S ::= ABC & AB c+ & a+ BC; S ::= ABC & AB c+ & AP BC; S ::= ABC & AB c+ & AP BC; AB ::= a AB? b; AB ::= a AB? b; AB ::= a AB? b; BC ::= b BC? c; BC ::= b BC? c; BC ::= b BC? c; ABC ::= a+ b+ c+; ABC ::= a+ b+ c+; ABC ::= AP b+ c+; AP ::= a+; AP ::= a+; AP ::= a+; (a) (b) (c)

  16. inline S S S S S S ABC a+ AB b+ BC c+ a+ AB b+ BC c+ AB? BC? AB? BC? a b c a b c ε ε ε ε S ::= ABC & AB c+ & a+ BC; S ::= a+ b+ c+ & AB c+ & a+ BC; AB ::= a AB? b; AB ::= a AB? b; BC ::= b BC? c; BC ::= b BC? c; ABC ::= a+ b+ c+; (a) (b)

  17. Solution (graphs) Language SPPFs Examples preserved preserved introduce, unlabel fold, inline preserved refactored 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

  18. 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?

  19. e 1 E E E e 2 e 3 E E E E e 5 e e E E E 4 6 2 + 2 + 2 + 2 t 1 t 2 t 3 t 4 t 5 t 6 t 7 Questions? Suggestions?

Recommend


More recommend