1 / 32

Gordana Rakić, Zoran Budimac

Gordana Rakić, Zoran Budimac. - eCST Generator -. Contents. Abstract Motivation Background Description Conclusion and results Future work . Abstract. In SMIILE w e introduce d enriched Concrete Syntax Tree (eCST) as universal intermediate representation of source code

Download Presentation

Gordana Rakić, Zoran Budimac

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Contents Abstract Motivation Background Description Conclusion and results Future work

  3. 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

  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

  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

  8. Broader applicability of eCST(2) Transform eCST to eCFG (enriched Control Flow Graph)

  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.

  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

  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

  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

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

  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,...

  15. Syntax Trees Syntax Trees 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

  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

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

  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

  19. Content of the CST and eCSTUniversal Nodes IF parenthesizedExpression ifStat = statement(ELSE elseStat = statement -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat)) ^(BRANCH ELSE $elseStat))| -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat))))

  20. Structure of the eCST

  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

  22. Universal nodes that do not directly affect CC metric

  23. Universal nodes that directly affect CC metric

  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

  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

  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

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

  31. Future work Adding parsers for new programming languages Maintenance of existing once according to changes of set of universal nodes

  32. Thank you   

More Related