A RefactorErl Projekt Erlang programok statikus elemzése és



Similar documents
Scala. A Java jövője. Háber János

Refactoring Erlang Programs

Google Web Toolkit GWT



E-KERESKEDELEM MOBILE WALLET-TEL

Quality Management Tools Of Chemical And Bio Industrial Data Systems And Procedures. Gergely Viczián

Bálványfa irtási kísérletek a Kisalföldi Life+ program keretében

03 - Lexical Analysis

Introduction to Java

CHAPTER 5 INTELLIGENT TECHNIQUES TO PREVENT SQL INJECTION ATTACKS

Special Directions for this Test

Parameter Passing. Standard mechanisms. Call by value-result Call by name, result

Protecting Wireless Networks of the Critical Information Infrastructures

Outline Basic concepts of Python language

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

Compiler Construction

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

Syntax Check of Embedded SQL in C++ with Proto

Compiler Construction

Hungarian Style Guide for Community

Topics. Query Repo Model Changeset

Visual Basic. murach's TRAINING & REFERENCE

SQL Tables, Keys, Views, Indexes

Introduction to Lex. General Description Input file Output file How matching is done Regular expressions Local names Using Lex

Scanning and parsing. Topics. Announcements Pick a partner by Monday Makeup lecture will be on Monday August 29th at 3pm

Sun a felsőoktatásban. Kállay Kristóf. Sun Microsystems Kft.

The spatial transformation of the production structure of transnational corporations: a case study of Volkswagen

In-Memory Database: Query Optimisation. S S Kausik ( ) Aamod Kore ( ) Mehul Goyal ( ) Nisheeth Lahoti ( )

The Elective Part of the NSS ICT Curriculum D. Software Development

Completing the Big Data Ecosystem:

Compiling Recursion to Reconfigurable Hardware using CLaSH

Theses of Doctoral (PhD) dissertation

Theory of Compilation

Other Map-Reduce (ish) Frameworks. William Cohen

Java technológiák 7. előadás A Struts keretrendszer

Felhő alapú üzemeltetési feladatok optimalizálása

Tutorial on C Language Programming

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016

Compiler I: Syntax Analysis Human Thought

Dart a modern web language


Google Apps Engine. G-Jacking AppEngine-based applications. Presented 30/05/2014. For HITB 2014 By Nicolas Collignon and Samir Megueddem

DiskPulse DISK CHANGE MONITOR

Java SE 8 Programming

The C Programming Language course syllabus associate level

Programming Languages CIS 443

Business Enterprise Server Help Desk Integration Guide. Version 3.5

This document presents the new features available in ngklast release 4.4 and KServer 4.2.

THE NECESSITY OF ECONOMIC ANALYSIS A GAZDASÁGI ELEMZÉS SZÜKSÉGESSÉGE. ANDREA PAP captain

SQL is capable in manipulating relational data SQL is not good for many other tasks

Supporting Data Set Joins in BIRT

PUBLICATIONS. 3, G. Bognár, Geometric aspects of some nonlinear differential equations, Nonlinear Analysis, 63 (2005),

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

SAP BusinessObjects Business Intelligence platform Document Version: 4.1 Support Package Information Design Tool User Guide

4. G. Jeney, Multi-user detektálás hibatűrésének vizsgálata, (in Hungarian), Magyar Távközlés, Vol. X, Issue 1, Jan. 1999, pp.

MongoDB Aggregation and Data Processing

MongoDB Aggregation and Data Processing Release 3.0.4

Sources: On the Web: Slides will be available on:

THE SYSTEMS OF INFORMATION AND COMMUNICATION TECHNOLOGY APPLYED BY THE GOVERNMENT

COS 333: Advanced Programming Techniques

SDMX technical standards Data validation and other major enhancements

ETRI-TAM Subproject Development Plan. SangSik Yoon Taesang Choi

Programming Language Pragmatics

WSDL-DSL + WSToolKit

Advanced Functional Programming (9) Domain Specific Embedded Languages

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

URI and UUID. Identifying things on the Web.

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Scanner. tokens scanner parser IR. source code. errors

Tutorial: Big Data Algorithms and Applications Under Hadoop KUNPENG ZHANG SIDDHARTHA BHATTACHARYYA

IENG2004 Industrial Database and Systems Design. Microsoft Access I. What is Microsoft Access? Architecture of Microsoft Access

Efficient Big Data Analytics using SQL and Map-Reduce

Programming Languages in Artificial Intelligence

Logitoring : log driven monitroing. the Rocket science. and. Eugene Istomin. IT Architect. e.istomin@edss.ee. Cone Center,Tallinn

Operating System Monitor Application (OS MON)

Lecture 22 The Shell and Shell Scripting

Hadoop: The Definitive Guide

Prolog A Tutorial Introduction James Lu Jerud J. Mead

Chapter 1: Introduction

Simple Network Management Protocol (SNMP) version 3.4

Transcription:

A RefactorErl Projekt Erlang programok statikus elemzése és refaktorálása Tóth Melinda KMOP-1.1.2-08/1-2008-0002 pályázat A kutatás-fejlesztési központok fejlesztése és megerősítése 2012. június 19., Budapest Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 1 / 9

Az alprojekt célkitűzései Szoftverek karbantartásának és átalakításának támogatása Refaktorálás Forráskód egységesítés Tulajdonság alapú tesztelés Kódmegértés támogatás Alkalmazás-specifikus nyelv fejlesztés Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 2 / 9

Erlang Ericsson által fejlesztett Telekommunikációs szoftverek írásának megkönnyítése Széleskörű ipari használat Sok millió soros szoftverek Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 3 / 9

RefactorErl mérföldkövek 2006 - Feladat az Ericssonból 2007, Augusztus - Első kiadás 2008, Augusztus - 15 refaktorálás az újratervezett rendszerben 2009, Október - Lekérdezések Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 4 / 9

RefactorErl Statikus forráskód elemző és transzformáló eszköz Ipari kódok elemzésére tervezve Perzisztens adattárolás Inkrementális elemzés Hatékony adatelérés Biztonságos transzformálás Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 5 / 9

3-rétegű gráf modell 1 Lexikális réteg Tokenek Preprocesszálás Comment, whitespace 2 Szintaktikus réteg Absztrakt Szintaxis-Fa File 3 Szemantikus réteg Modul, függvény, rekord, változó, környezet elemzés Adatfolyam, mellékhatás Aszinkron elemző infrastruktúra Utóelemzések: dinamikus függvényhívás elemzés, folyamatelemzés, ets elemzés Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 6 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

-module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put chars(?eol(s)). my.erl function put chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put chars (? EOL ( S ) ). Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 7 / 9

Gráf tárolás és kezelés A csúcsok és élek Mnesia táblákban vannak tárolva* Csúcs attribútumok: token szöveg, változó név,... Élcímkék: sub, funref, varref,... Gráf bejárás: szűrt élcímke sorozat Az élek indexeltek Nem ugrik meg a lekérdezések költsége A gyakran használt lekérdezések fix hosszúak Szintaxis alapú transzformációk, automatikus token kezelés Inkrementális, automatizált szemantikus elemzések Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 8 / 9

Alternatív tárolási módok NIF Gráf: C++ Kyoto Cabinet: C Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 9 / 9

Refaktorálás A forráskód szerkezetének átalakítása Viselkedés/jelentés megőrzése RefactorErl eredményessége Szintaktikus átalakítás Szemantikus és lexikális struktúra automatikusan áll helyre 25 megvalósított transzformáció Metrika vezérelt átalakítások Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 10 / 9

Implementált transzformációk Rename variable function record, record field macro module/header file Function interface introduce function argument reorder parameters introduce tuple eliminate/introduce import Move definition macro record function Expression structure eliminate/introduce variable eliminate/introduce function eliminate macro application eliminate fun-expression Data structure Introduce record Upgrade module interface Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 11 / 9

Tulajdonság alapú tesztelés A transzformációk helyességének ellenőrzése QuickCheck/PropEr tulajdonság alapú tesztelővel A refaktorálások tulajdonságai formalizáltak Viselkedés megőrzés ellenőrzése Véletlenszerűen generált transzformációs paraméterek Véletlenszerűen generált programokon Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 12 / 9

Kódmegértés támogatása Szemantikus információ elérhetővé tétele Lekérdező nyelv Függőségi elemzések és vizualizáció Metrikák Klaszterezés Kód böngészés beépített lekérdezésekkel Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 13 / 9

Lekérdező nyelv Az Erlang nyelv jellemzőire és szemantikus fogalmaira épül Entitás + szelektor + tulajdonság mods.funs.refs mods[name=alma].funs.refs Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 14 / 9

Syntax of semantic queries semantic_query ::= initial_selection [. query_sequence] initial_selection ::= initial_selector [ [ filter ] ] query_sequence ::= query [. query_sequence] query ::= selection iteration closure property_query selection ::= selector [ [ filter ] ] iteration ::= { query_sequence } int [ [ filter ] ] closure ::= ( query_sequence ) int [ [ filter ] ] ( query_sequence )+ [ [ filter ] ] property_query ::= property [ [ filter ] ] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 15 / 9

Syntax of semantic queries semantic_query ::= initial_selection [. query_sequence] initial_selection ::= initial_selector [ [ filter ] ] query_sequence ::= query [. query_sequence] query ::= selection iteration closure property_query selection ::= selector [ [ filter ] ] iteration ::= { query_sequence } int [ [ filter ] ] closure ::= ( query_sequence ) int [ [ filter ] ] ( query_sequence )+ [ [ filter ] ] property_query ::= property [ [ filter ] ] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 15 / 9

Syntax of semantic queries semantic_query ::= initial_selection [. query_sequence] initial_selection ::= initial_selector [ [ filter ] ] query_sequence ::= query [. query_sequence] query ::= selection iteration closure property_query selection ::= selector [ [ filter ] ] iteration ::= { query_sequence } int [ [ filter ] ] closure ::= ( query_sequence ) int [ [ filter ] ] ( query_sequence )+ [ [ filter ] ] property_query ::= property [ [ filter ] ] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 15 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Szemantikus lekérdezések Value of a variable @expr.origin Call chain @fun.(called by)+ @fun.(calls)+ Side effect @fun.dirty Dynamic function calls @fun.refs @fun.dyncall @fun.dyncalled by @expr.dynfuns Sent messages mods.funs.exprs [.sub[index==1 and value==upd] and type==send expr] Received messages mods.funs. exprs[type==receive expr].sub[.sub[index==1 and value==upd] and type == tuple] Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 16 / 9

Függőségi elemzés Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 17 / 9

A szoftver Fejlesztő környezetbe építve: Emacs, Vi, Eclipse Interaktív és szkriptelhető Erlang shell interfész Parancssoros használat Webes felület Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 18 / 9

Webes Felület Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 19 / 9

Eredmények Megjelent cikkek, előadások, poszterek: 9 + 14 + 11 Szakdolgozat/Diplomamunka: 14 5 TDK dolgozat: egy 2. díj, egy 3. díj az OTDK-n 2011-ben, 2 dolgozat bemutatása 2013-ban Bevont hallgatók száma: 10-20/szemeszter Oktatási hasznosítás: Szoftvertechnológia laborok, Erlang Szoftver: RefactorErl Tóth Melinda (ELTE IK.) Statikus elemzés 2012. június 19., Budapest 20 / 9