rotor first steps towards a refactoring tool for ocaml
play

Rotor: First Steps Towards a Refactoring Tool for OCaml Reuben N. - PowerPoint PPT Presentation

Rotor: First Steps Towards a Refactoring Tool for OCaml Reuben N. S. Rowe r.n.s.rowe @ kent.ac.uk Simon Thompson s.j.thompson @ kent.ac.uk University of Kent, Canterbury OCaml Users and Developers Workshop, Oxford, UK Friday 8 th September


  1. Rotor: First Steps Towards a Refactoring Tool for OCaml Reuben N. S. Rowe r.n.s.rowe @ kent.ac.uk Simon Thompson s.j.thompson @ kent.ac.uk University of Kent, Canterbury OCaml Users and Developers Workshop, Oxford, UK Friday 8 th September 2017

  2. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  3. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  4. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  5. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  6. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  7. What is Rotor? R eliable O Caml-based T ool for O Caml R efactoring 1/9

  8. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  9. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  10. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  11. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  12. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  13. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  14. What is Rotor? • Written in OCaml itself • allows re-use of the existing compiler infrastructure • Provide evidence that the result is correct (Future work) • A prototype refactoring tool for OCaml (4.04.x) programs • currently implements renaming for value bindings • Designed with extensibility in mind • write new refactorings and ‘plug them in’ easily 1/9

  15. Renaming Value Bindings: Rebinding src/foo.ml: . . . open Foo src/bar.ml: . . . . . . 2/9 Foo.f �→ g let f = . . . let f = . . . . . . f . . . . . . f . . .

  16. Renaming Value Bindings: Rebinding src/foo.ml: . . . open Foo src/bar.ml: . . . . . . 2/9 Foo.f �→ g let f = . . . let g = . . . . . . g . . . . . . g . . .

  17. Renaming Value Bindings: Rebinding src/foo.ml: . . . open Foo src/bar.ml: 2/9 . . . Foo.f �→ g let g = . . . let f = . . . let f = . . . . . . . . . . . . f . . . g . . .

  18. Renaming Value Bindings: Rebinding src/foo.ml: . . . open Foo src/bar.ml: . . . 2/9 Foo.f �→ g let g = . . . let f = . . . let g = . . . . . . g . . . . . . g . . . g . . .

  19. Renaming Value Bindings: Punning src/bar.ml: map ~ ['a';'b';'c'] . . . let map ~f xs = open Foo 3/9 src/foo.ml: . . . Foo.f �→ g type t = { f : . . . ; . . . } let f = . . . . . . { f; . . . } : t . . .

  20. Renaming Value Bindings: Punning src/foo.ml: . . . open Foo src/bar.ml: 3/9 . . . Foo.f �→ g type t = { f : . . . ; . . . } let f = . . . . . . { f; . . . } : t . . . let map ~f xs = . . . . . . map ~f ['a';'b';'c'] . . .

  21. Renaming Value Bindings: Punning src/foo.ml: . . . open Foo src/bar.ml: 3/9 . . . Foo.f �→ g type t = { f : . . . ; . . . } let g = . . . . . . { f=g; . . . } : t . . . let map ~f xs = . . . . . . map ~f:g ['a';'b';'c'] . . .

  22. Renaming Value Bindings: include include Foo . . . src/baz.ml: . . . g src/foo.ml: Bar.f src/bar.ml: . . . 4/9 Foo.f �→ g let f = . . . . . . f . . . . . . Bar.f . . .

  23. Renaming Value Bindings: include include Foo . . . src/baz.ml: . . . g src/foo.ml: Bar.f src/bar.ml: . . . 4/9 Foo.f �→ g let g = . . . . . . g . . . . . . Bar.g . . .

  24. Renaming Value Bindings: include src/foo.ml: . . . src/baz.ml: . . . include Foo src/bar.ml: . . . 4/9 Foo.f �→ g let g = . . . . . . g . . . Bar.f �→ g . . . Bar.g . . .

  25. Renaming Value Bindings: Module Signatures Sig.S.f end module M : Sig.S = struct let f = src/baz.ml: end module type S = sig val f : g src/sig.ml: src/foo.ml: include Sig.S src/bar.mli: include Foo src/bar.ml: 5/9 Foo.f �→ g let f = . . . Bar.f �→ g

  26. Renaming Value Bindings: Module Signatures src/sig.ml: end module M : Sig.S = struct let f = src/baz.ml: g Sig.S.f include Sig.S src/foo.ml: src/bar.mli: include Foo src/bar.ml: 5/9 Foo.f �→ g let f = . . . Bar.f �→ g module type S = sig val f : . . . end

  27. Renaming Value Bindings: Module Signatures src/foo.ml: src/bar.ml: include Foo src/bar.mli: include Sig.S src/sig.ml: src/baz.ml: module M : Sig.S = struct let f = end 5/9 Foo.f �→ g let f = . . . Bar.f �→ g Sig.S.f �→ g module type S = sig val f : . . . end

  28. Renaming Value Bindings: Module Signatures src/foo.ml: src/bar.ml: include Foo src/bar.mli: include Sig.S src/sig.ml: src/baz.ml: 5/9 Foo.f �→ g let f = . . . Bar.f �→ g Sig.S.f �→ g module type S = sig val f : . . . end module M : Sig.S = struct let f = . . . end

  29. Renaming Value Bindings: Module Signatures src/foo.ml: src/bar.ml: include Foo src/bar.mli: include Sig.S src/sig.ml: src/baz.ml: 5/9 Foo.f �→ g let g = . . . Bar.f �→ g Sig.S.f �→ g module type S = sig val g : . . . end module M : Sig.S = struct let g = . . . end

  30. Renaming Value Bindings: Module Signatures src/foo.ml: src/bar.ml: include Foo src/bar.mli: include Sig.S src/sig.ml: src/baz.ml: 5/9 Foo.f �→ g let g = . . . Bar.f �→ g Sig.S.f �→ g module type S = sig val g : . . . end module M : Sig.S = struct let g = . . . end

  31. Rotor: Architectural Overview 6/9

  32. Rotor: Architectural Overview Visitors Path_visitors Longident_visitors . . . Types_visitors Parsetree_visitors Typedtree_visitors 6/9

  33. Rotor: Architectural Overview Path_visitors Typedtree_visitors Parsetree_visitors Types_visitors . . . Longident_visitors Visitors Compiler-libs Typedtree Parsetree Types . . . Longident Path 6/9

  34. Rotor: Architectural Overview Path_visitors Typedtree_visitors Parsetree_visitors Types_visitors . . . Longident_visitors Visitors Compiler-libs Typedtree Parsetree Types . . . Longident Path 6/9

  35. Rotor: Architectural Overview . Deps View Identifier Elements Language Typedtree_visitors Parsetree_visitors Types_visitors . . Longident_visitors Compiler-libs Path_visitors Visitors Typedtree Parsetree Types . . . Longident Path 6/9

  36. Rotor: Architectural Overview Types_visitors Buildenv Codebase Sourcefile Fileinfos Infrastructure Deps View Identifier Elements Language Typedtree_visitors Parsetree_visitors . Compiler-libs . . Longident_visitors Path_visitors Visitors Typedtree Parsetree Types . . . Longident Path 6/9

  37. Rotor: Architectural Overview Codebase Identifier View Deps Infrastructure Fileinfos Sourcefile Buildenv Language Refactoring Replacement Refactoring Refactoring_lib Refactoring_utils Refactoring_visitors Elements Typedtree_visitors Compiler-libs Parsetree Path Longident . . . Types Typedtree Parsetree_visitors Visitors Path_visitors Longident_visitors . . . Types_visitors 6/9

Recommend


More recommend