intermediate representations of functional programming
play

Intermediate representations of functional programming languages for - PowerPoint PPT Presentation

Intermediate representations of functional programming languages for software quality control Melinda Tth, Gordana Raki c Etvs Lornd University University of Novi Sad Faculty of Informatics Chair of Computer Science Aug. 27., 2013


  1. Intermediate representations of functional programming languages for software quality control Melinda Tóth, Gordana Raki´ c Eötvös Loránd University University of Novi Sad Faculty of Informatics Chair of Computer Science Aug. 27., 2013 The 13 th Workshop on "Software Engineering Education and Reverse Engineering" T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 1 / 31

  2. Motivation Static Analyser Tools RefactorErl SSQSA Static source code Set of Software analyser and Quality Static transformer Analyzers Erlang Language independent T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 2 / 31

  3. Motivation Static Analyser Tools RefactorErl SSQSA Code Comprehension Clone detection Refactoring Metrics Query Language Software network analysis Clone detection Analyze evolutionary Metrics changes Dependence analysis T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 3 / 31

  4. Motivation Static Analyser Tools RefactorErl SSQSA Semantic Program Graph, Enriched Concrete Syntax SPG Tree, eCST T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 4 / 31

  5. Motivation Static Analyser Tools RefactorErl SSQSA Semantic Program Graph, Enriched Concrete Syntax SPG Tree, eCST T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 5 / 31

  6. SSQSA SSQSA T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 6 / 31

  7. RefactorErl Erlang Supervisor Functional Soft real-time Highly concurrent Hot code swap Distributed Erlang VM Fault-tolerant T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 7 / 31

  8. RefactorErl History Started in 2006 Software Technology Lab (4*4 ECTS) since 2008 One of the 8 labs 10-20 students (BSc, MSc, PhD) ELTE-Ericsson Software Technology Lab since 2011 T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 8 / 31

  9. RefactorErl RefactorErl Static source code analyser and transformer tool for Erlang Refactoring – less error prone & fast Program comprehension Support in everyday work & debugging & complex tasks, e.g. Rename a function, search definition Find the value of a variable Program comprehension, component relation detection Program restructuring T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 9 / 31

  10. RefactorErl RefactorErl (cont.) Platform for source code transformations – 24 implemented refactorings Rename/Move definition Expression structure Function interface Structural source code analysis – Clustering Support program comprehension Call graph visualisation Dependency analysis Semantic Query Language / Metric Query Language T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 10 / 31

  11. RefactorErl User Interfaces T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 11 / 31

  12. RefactorErl Semantic Program Graph 1 Lexical level Tokens Preprocessing Comments, whitespace 2 Syntactic level Abstract Syntax Tree Files 3 Semantic level Module, function, record, variable nodes Links to definition and reference points T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 12 / 31

  13. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  14. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  15. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  16. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  17. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  18. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  19. RefactorErl -module(my). -define(EOL(X), X ++ "\n"). f(S) -> io:put_chars(?EOL(S)). my.erl put_chars function my app f ++ modq io var string var atom atom atom S ++ "\n" S f ( S ) -> io : put_chars ( ? EOL ( S ) ) . T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31

  20. RefactorErl Example graph ROOT file/1 my.erl incl/1 form/3 form/1 function form module/1 funcl/1 flex/1 flex/2 flex/3 flex/4 flex/5 flex/6 flex/1 moddef/1 clause 1 stop 35 module 2 ( 3 atom 4 ) 5 stop 6 - 1 functx/1scope/1 fundef . module ( my ) . - clex/2 clex/3 name/1 clex/1 modctx/1 fundef/1 expr 1 ) 23 -> 24 ( 21 top/1 my ) -> atom f ( elex/1 func/1 atom 20 visib/1 pattern/1 f/1 f fpar/1 undefined 11 vardef/1 varvis/1 fpar flow/1 pattern 2 form/2 top/1 body/1 visib/2 module/2 variable S elex/1 flow/1 expr 6 variable 22 varintro/1 varbind/1 S variable S varref/1 esub/1 flow/1 fret/1 expr 8 S infix_expr ++ elex/1 esub/2 flow/1 top/1 expr 7 elex/1 dep/1 top/1 funcall/1 string elex/1 top/1 esub/1 expr 10 top/1 token token token application llex/1 llex/1 llex/1 top/1 esub/1 top/1 esub/2 flow/1 expr 5 expr 9 undefined 12 subst dep/1 top/1 dep/1 top/1 infix_expr : arglist fret orig/1 llex/4 mref/1 llex/3 llex/5 llex/1 llex/2 esub/2 elex/1 elex/1 esub/1 elex/2 expr 4 expr 3 ( 31 ) 33 ? 29 variable 30 : 26 ( 28 ) 34 param form orig/1 orig/1 funeref/1 ( ) ? EOL atom put_chars : ( ) atom io llex/1 flex/5 flex/2 flex/3 flex/4 flex/6 flex/7 flex/8 flex/9 flex/1 elex/1 elex/1 modref/1 variable 32 atom 8 ( 9 variable 10 , 14 ) 18 stop 19 - 7 atom 27 atom 25 arg body io S define ( EOL , ) . - put_chars io llex/3 llex/1 llex/2 llex/1 llex/2 llex/3 func/1 ) 13 ( 11 variable 12 variable 15 ++ 16 string 17 put_chars/1 " ) ( X X ++ " fpar/1 fret/1 undefined 13 undefined 14 fpar fret T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 14 / 31

  21. RefactorErl Analysis Details Extended syntax description Defines the representation Source for parser, lexer, and token updater Semantic Analyser framework Extensible, modular structure Works on syntactic subtrees (incremental) Asynchronous parallel execution Side-effect analysis, data-flow analysis, dynamic function call analysis T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 15 / 31

  22. Mapping Mapping Attila Páter-Részeg, TDK Thesis, Scientific Student Association Conference, June 2013 convert: SG → ECST convert N : SG N → ECST M file COMPILATION_UNIT form FUNCTION_DECL ... ... T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 16 / 31

  23. Mapping Simple Erlang Module -module(a). f() -> ok. T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 17 / 31

  24. Mapping SPG representation for module a ROOT file/1 a.erl incl/1 form/2 form/1 function form module/1 moddef/1 flex/1 funcl/1 flex/1 flex/2 flex/3 flex/4 flex/5 flex/6 clause 1 stop 12 - 1 module 2 ( 3 atom 4 ) 5 stop 6 functx/1scope/1 . fundef - module ( a ) . fundef/1 modctx/1 clex/3 body/1 visib/1 name/1 clex/1 clex/2 expr 2 expr 1 -> 10 ( 8 ) 9 a top/1 top/1 -> atom ok atom f ( ) func/1 elex/1 elex/1 atom 11 atom 7 f/0 flow/1 ok f fret/1 undefined 3 fret T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 18 / 31

  25. Mapping XML representation for module a T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 19 / 31

  26. Mapping eCST representation for module a T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 20 / 31

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend