Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gordana Rakić, Zoran Budimac

Similar presentations


Presentation on theme: "Gordana Rakić, Zoran Budimac"— Presentation transcript:

1 Gordana Rakić, Zoran Budimac
- eCST Generator - Gordana Rakić, Zoran Budimac 1

2 Contents Abstract Motivation Background Description
Conclusion and results Future work Odavde treba da pricam ja. Jos cu sredjivati 2

3 Part of SMIILE  eCST Generator
Abstract In SMIILE we introduced enriched Concrete Syntax Tree (eCST) as universal intermediate representation of source code Part of SMIILE  eCST Generator

4 Contents Abstract Motivation Background Description
Conclusion and results Future work References 4

5 Systematic review on tools - conclusion -
Practice needs new tool which Is platform independent Is programming language independent Calculates broad specter of metrics Supports keeping of source code history Supports keeping of calculated values of software metrics !!!will be supported by other techniques … we need software tool for software quality assessment applicable through evolution phases I analiya dostupnih orudja I radova na temu orudja I tehnika vodili su nas ka postavljenim ciljevima

6 Broader applicability of eCST
!

7 Broader applicability of eCST(1)
Limitation: eCST represents only separate compilation unit (class, module,...) Solution: detect function, procedure, mothod,... (FUNCTION_DECL, FUNCTION_DEF) and their calls (FUNCTION_CALL) and connect compilation units in enriched Call Graph OVO NAM RADI SNEIPL!!! Ako otklonimo ogranicenje da eCST predstavlja separatnu compilacionu jedinicu moci cemo kompletnije da repreyentujemo ne samo source code vec i dizajn. Detektovacemo funkcije unutar compilacionih jedinica I njihove pozive (koji se mogu nalaziti bilo gde u kodu - u istoj jedinici ili u drugoj koja moze biti I u drugom paketu,…) a onda povezati call sa svojom jedinicom u usmereni graf - takoyvani enriched call graph Na ovakav graf primenljiva je I teorija kompleksnih mreza [Savic,…]

8 Broader applicability of eCST(2)
Transform eCST to eCFG (enriched Control Flow Graph) Takodje, mozemo eCST konvertovati u eCFG… Povezujemo univerzalne cvorove prateci tok izvrsavanja programa.

9 Broader applicability of eCST (2a)
Transform eCST to eCFG (enriched Control Flow Graph) which can be used in software testing dead and duplicated code discovering, code-clone analysis basis for connecting compilation units instead of original eCST. In this case language independent call graph would be created by connecting eCFG components that represent compilation units. … na taj nacin polje primene sirimo na testing, analizu mrtvog koda, dupliranog koda… generalno staticku analizu koda Ovde je primenljiva I ideja o povezivanju compilacionih jedninica tako sto bismo sada umesto eCST u call graph povezivali eCFG unite i na taj nacin vec postojece grafove dodatno uvezali

10 Broader applicability of eCST (3)
Automatic source code translation between programming languages (e.g. translation from Java to Modula-2 or from Modula-2 to Java) For automatic translation by using eCST we would have reflection table with rules for translation. E.g. we should have rule about: How to translate the loop How to translate the condition How to translate inside statements Imperfections in source code could be eliminated by several cycles of code transformation Moguce je koristiti eCST (pa I eCFG) za automatsko prevodjenje koda (dovoljno detalja je na slajdu da sad ovde ne prepisujem), a za sve probleme koji nastanu kodu nakon prevodjenja mozemo koristiti donijeve transformacije.

11 Broader applicability of eCST (4)
Indirectly – through SMIILE tool In development input language independent metric based advising system which would communicate with its user by concrete advices for corrections and refactoring of the source code based on calculated software metrics metric values storage well organized XML file system as primarily planed external software metrics repository This gives additional value to possibility for code translation Possibility of keeping history of source code (in XML storage) enables support of code-change analysis important support in software reengineering process Dodatno, kroz karakteristike SMIILE toola a koje se baziraju na eCST mozemo doci do orudja koje ce, takvo kakvo je (nezavisno od jezika) savetovati korisnike na osnovu dublje analize izracunatih vrednosti metrika. Za to nam je potreban dobar nacin za skladistenje vrednosti bilo u XMLu kao sto je predvidjeno u okviru SMIILEa ili koristeci se karakteristikama spoljnog repozitorijuma. Interacija SMIILE I jednog takvog repozitorijuma je prikazana u radu 11. Ovakvi saveti,npr. za refaktorisanje koda mogu dodati vrednost I automatskom prevodjenju koda jer se na taj nacin mogu resiti eventualni preostali problemi u kodu nakon transformacija koda. Takodje bi se mogla razmotriti I automatizacija refaktoringa. Dodatno, mogucnost cuvanja istorije koda u XML repozitorijumu *na bazi eCSTa* omogucava change analysis

12 *Software Metrics Independent of Input LanguagE* SMIILE Tool
Developed in Java programing language Based on eCST: Plograming language independency Source code history keeping (in XML) Metric values history keeping (in XML) In current prototype Metrics Cyclomatic Complexity – CC (by predicate counting) Lines of Code – LOC (by filled lines counting) Halstead Programming languages Java C# Delphi Modula 2 COBOL NAstavak motivacije>Ako krenemo od karakteristika SMIILE-a… sve ostale komponente poseduju crvene karakteristike Dodavanjem dodatnih komponenti dobijamo dodatne mogucnosti… pratimo izmene I njohov uticaj na vrednosti metrika, poveyivanjem mreze *SNEIPL* dobijamo mogucnost da racunamo mnoge druge metrike (metrike diyajna npr), mogucnost primene u nastavi,…

13 Contents Abstract Motivation Background Description
Conclusion and results Future work References 13

14 Parser Generators Tool used for generation of language translators
Input language grammar Output Language scanner Language parser + Intermediate representation of language constructions !syntax trees! ANTLR, JavaCC, CocoR,... Parser generatori prihvataju na ulazugramatiku jezika a na izlazu dostavljaju skener, parser I medjureprezentaciju koj aje najcesce sintaksno stablo

15 Syntax Trees Syntax Trees Represent Intermediate structure produced by
parser generator directly translator generated by parser generator Represent language in abstract form concrete source code concrete source code elements attached to corresponding abstract language elements Tako nastala sintaksna stabla mogu biti raylicitih vrsta i mogu nastati na razlicite ancine

16 Syntax Trees (2) Classification of Syntax trees used in this thesis
Abstract Syntax Tree (AST) represents concrete source code Concrete Syntax Tree (CST) represents concrete source code elements attached to corresponding abstract language elements Enriched Concrete Syntax Tree (eCST) Represents concrete source code elements attached to corresponding abstract language elements Contains additional information - universal nodes as markers for language elements figuring in metric algorithms AST, CST, eCST / najbogatije, sadrzi sve sto sadrze AST I CST I jos je obogaceno univeryalnim cvorovima

17 Contents Abstract Motivation Background Description
Conclusion and results. Future work References Yapitali smo se da li ova stabla mogu imati siru primenu 17

18 Background of the universality
Enriched Concrete Syntax Tree (eCST) Generated by Parser generator Generation is based on programming language grammar Enrichment is based on modification of programming language grammar by adding universal nodes into tree Stored to XML structure Enrichment does not effect structure of the tree Only content of the tree is affected by these changes Generise se poyivom parsera generisanomg upotrebom parser generatora, obogaceno dodavanjem cvorova u pravila gramatike direktno, transformisemo ga u XMLybog sire korisnosti 18

19 Content of the CST and eCST Universal Nodes
Levo je CST, desno je eCST CST je yavisno od sintakse jezika, eCST zbog zaokruzenih univerzalnih cvorova koji su isti nezavisno od jezika postaje nezavisno od sintakse jezika . Takvo stablo dobijamo dodavanjem odgovarajucih cvorova I pravila gramatike koja uticu na sadrzaj stabla koje ce se genrisati poyivom parsera generisanog iz gramatike. IF parenthesizedExpression ifStat = statement (ELSE elseStat = statement -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat)) ^(BRANCH ELSE $elseStat))| > ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat))) ) 19

20 Structure of the eCST 20

21 Example: universal nodes for Cyclomatic Complexity metric algorithm
Cyclometic Complexity (CC) is counted by predicate counting method We are searching eCST for universal nodes representing language characteristic syntax elements and counting universal nodes intead elements of language syntax Ako CC racunamo prebrojavanjem predikata onda trayenje tih predikata jako zavisi od sintakse jezika. Tako bismo imali potrebu za posebnom implementacijom algoritma za izracunavanje CC za svaki jezik koji zelimo podrzati. Uvodjenjem univerzalnih cvorova kao na prethodnom slajdu trazimo samo univerzalne cvorove koji reprezentuju odgovarajuce elemente sintakse jezika I brojimo ih umesto samih predikata.

22 Universal nodes that do not directly affect CC metric
Node \ Language JAVA MODULA-2 COBOL COMPILATION_UNIT Class MODULE PROGRAM CONCRETE_UNIT_DECL Concrete Class (IMPLEMENTATION) MODULE PROCEDURE DIVISION FUNCTION_DECL Method Declaraton PROCEDURE Procedure Declaration MAIN_BLOCK - BEGIN (Of Main Block ) MAINLINE CONDITION Start of Condition In Branch Statement Or Loop BRANCH_STATEMENT Start of Branch Statement (each part will be additionally marked with BRANCH node) e.g. switch e.g. case e.g. EVALUATE Pogledajmo pomocne univerzalne cvorove koji nam pomazu da detektujemo komilacionu jedinicu, funkciju, uslov I grananje. Ovi cvorovi ne uticu na vrednost CC ali igraju svoju ulogu jer se upravo za neke od ovih elemenata u kodu izrazava vrednost CC, dok su drugi samo pomocni.

23 Universal nodes that directly affect CC metric
Node \ Language JAVA MODULA-2 COBOL BRANCH if else ? : case default catch IF ELSIF ELSE CASE WHEN END-OF-PAGE (ON) EXCEPTION INVALID KEY (ON) OVERFLOW (ON) SIZE ERROR JUMP_STATEMENT break return continue throw(s) EXIT RETURN STOP GO-TO GO-BACK LOOP_STATEMENT for while repeat do-while FOR WHILE REPEAT LOOP VARYING TIMES PERFORM-UNTIL LOGICAL_OPERATOR && || AND OR ALSO NAvodimo I univeryalne cvorove koji direkno uticu na vrednost CC. Dati su elementi tri karakteristicna jezika podeljeni po pridruzenim univerzalnim cvorovima JUMP_Statement je istaknut kao univeryalni cvor za koji jor postoje otvorena pitanja, ali ove dileme ne odvode do losih vrednosti CC metrike vec su dublja i mogu voditi ka nekim dubljim zakljucima…

24 JUMP_STATEMENT open questions
Return, break,... Are these statements always the jumps? GO_TO (and similar statements) Could it be improved (maybe by involving the enriched Control Flow Graph - eCFG)? Could we distinguish: JUMP_TO_BACK JUMP_TO_FORWARD To su – da li su return, break ,… uvek jumpovi I kako razlikovati jumpove dublja analiza… necemo se sada zadrzavati na tome

25 Documenting: all universal nodes

26 eCST Generator

27 Storing additional data - Programming Languages -
Enables dynamic recognition of input programming language based on input file extension

28 Contents Abstract Motivation Background Description
Conclusion and results. Future work References 28

29 Results eCST - new source code and model representation
eCST generator – component that generate and extract eCST in XML format Idea for introducing eCST is supported by example of successful development of the prototype of language independent software metrics tool Fresh idea for further usage of eCST in software development and maintenance Dali smo opis nove reprezentacije source coda Dali primer uspesne primene I razmotrili razne ideje za potencijalnu siru primenu

30 Contents Abstract Motivation Background Description
Conclusion and results. Future work References 30

31 Future work Adding parsers for new programming languages
Maintenance of existing once according to changes of set of universal nodes Ovo je poslednji moj slajd

32 Thank you   


Download ppt "Gordana Rakić, Zoran Budimac"

Similar presentations


Ads by Google