u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Faculty of Science Programming Macro Tree Transducers Patrick Bahr 1 Laurence E. Day 2 1 University of Copenhagen, Department of Computer Science paba@diku.dk 2 University of Nottingham, Functional Programming Laboratory led@cs.nott.ac.uk 9th Workshop on Generic Programming, 28th September, 2013, Boston, Massachusetts Slide 1
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Macro Tree Transducers on One Slide Tree Transducers in FP • automaton transforming trees to trees • states are interpreted as functions tree transducer = set of mutually recursive functions � Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 2
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Macro Tree Transducers on One Slide Tree Transducers in FP • automaton transforming trees to trees • states are interpreted as functions tree transducer = set of mutually recursive functions � Macro tree transducers • extension of tree transducers • each function may have accumulation parameters Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 2
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e This Paper: A Different Interpretation of MTT still: MTTs as generalisation of top-down tree transducers Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 3
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e This Paper: A Different Interpretation of MTT still: MTTs as generalisation of top-down tree transducers Our interpretation of tree transducers • literal interpretation: states are still states • hence: a single function � meta programming Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 3
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e This Paper: A Different Interpretation of MTT still: MTTs as generalisation of top-down tree transducers Our interpretation of tree transducers • literal interpretation: states are still states • hence: a single function � meta programming How so? Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 3
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e This Paper: A Different Interpretation of MTT still: MTTs as generalisation of top-down tree transducers Our interpretation of tree transducers • literal interpretation: states are still states • hence: a single function � meta programming How so? Macro Tree Transducers = Tree Transducers + parametricity Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 3
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Agenda 1 From String Acceptors to Tree Transducers Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 4
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Agenda 1 From String Acceptors to Tree Transducers 2 Programming with Tree Transducers in Haskell Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 4
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Agenda 1 From String Acceptors to Tree Transducers 2 Programming with Tree Transducers in Haskell 3 Tree Transducers with Polymorphic State Space Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 4
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Agenda 1 From String Acceptors to Tree Transducers 2 Programming with Tree Transducers in Haskell 3 Tree Transducers with Polymorphic State Space 4 Macro Tree Transducers (= Tree Transducers with Accumulation Parameters) Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 4
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 ∈ Q F ? q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 ∈ Q F ? Acceptor q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 ∈ Q F ? Transducer? q , s → q ′ Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 Transducer q , s → q ′ , w Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings w o r d q 0 q 1 q 2 q 3 q 4 Transducer q , s → q ′ , w Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings ne w w ord ε w o r d q 0 q 1 q 2 q 3 q 4 Transducer q , s → q ′ , w Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Finite State Automata – On Strings new word ne w w ord ε w o r d q 0 q 1 q 2 q 3 q 4 Transducer q , s → q ′ , w Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 5
u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f c o m p u t e r s c i e n c e Now on Trees! not and or not tt b b Patrick Bahr, Laurence E. Day — Programming Macro Tree Transducers — WGP ’13, 28th September, Boston, Massachusetts Slide 6
Recommend
More recommend