SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac.
-
date post
21-Dec-2015 -
Category
Documents
-
view
216 -
download
0
Transcript of SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac.
Contents Last year... Motivation (why we did it) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work
Last year• First prototype of “universal” software metrics tool
• Characteristics– Platform independency
• Developed in Java Programming Language
– Application range • Two programming languages (Modula-2 and Java)• Two software metrics (CC and LOC)
– Annotated syntax tree based source code and metric values representation - enables
• Source code and metric values history • Language independency of the tool
ContentsLast year…
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
…Motivation…• Many techniques/tools are appropriate for only one programming language or for one
type of programming languages
• Support of object-oriented metrics is still weak
• Many techniques/tools compute numerical results with no real interpretation of their meanings
• There are no hints and advices what typical actions should be taken in order to improve the software
• The technique/tool should discourage cheating
• Current techniques/tools are not sensitive to the existence of additional code
• Sometimes is not clear which specific software metric have to be applied to accomplish the specific goal.
• PLUS
– Platform dependency
– Support for other metrics
– History of source code
– History of calculated metrics
ContentsLast year …
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
Related work
• Review of software metric tools available for usage
– Based on testing
• Review of available literature
– Based on• research papers
• available development and product documentation
Review 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
Contents
Last year…
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
Description
• The tool description
• Background of universality
• Support for metrics and lanaguages
Parser Generators
• Tool used for generation of language translators
• Input
– language grammar
• Output
– Language scanner
– Language parser
+ Intermediate representation of language constructions
!syntax trees!
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
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
Background of 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
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))))
Current state• In current prototype
– metrics • Cyclomatic Complexity – CC (by predicate counting)• Lines of Code – LOC (by filled lines counting)
– Programming languages • Java• Modula 2 • COBOL
– All calculations and tree transformations in one pass through code
• XML eCST is large for multiple parsing
Adding support for new Programming Language
if (support for new PL is needed) then
begin
modify existing grammar* of new PL (add universal nodes);
generate parser;
add new element in Languages XML structure
end
____________________________________________*Different grammars are supported by different parser generators. As we use ANTLR parser generator in this prototype grammar of new language should be LL(*)
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
Universal nodes that directly affect CC metric Node \ Language JAVA MODULA-2 COBOL
BRANCH
ifelse
?:
case defaultcatch
IFELSIF ELSECASE
WHENEND-OF-PAGE
(ON) EXCEPTIONINVALID KEY
(ON) OVERFLOW(ON) SIZE ERROR
IF
JUMP_STATEMENT
breakreturn
continuethrow(s)
EXITRETURN
STOPEXIT
GO-TOGO-BACK
LOOP_STATEMENT
forwhile
repeatdo-while
FORWHILEREPEATLOOP
VARYINGTIMES
PERFORM-UNTIL
LOGICAL_OPERATOR&& ||
ANDOR
ANDOR
ALSO
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
Adding support for new Software Metrics
if (support for new Software Metrics is needed) then
begin
determine corresponding new universal nodes;
modify grammars for all supported languages;
regenerate language parsers;
add attribute for storing new metric in XML structure
for storing metric values;
add software metric algorithm implementation in measure class
end
Contents
Last year…
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
Example
Not today
• For now we used only small example to test grammar and parser, and generation of universal nodes
• It is hard to find appropriate example implemented in all three languages in order to compare results
Contents
Last year…
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
Results and conclusion
• Motivation and background for development of new software metrics tool which is
– 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
Results and conclusions (2)• Developed prototype of new software metrics tool
which is
– Developed in PL Java
• is platform independent
– Developed to support two input PLs
• Is not programming language independent but base for it is sited
– This year we made one step forward
– Developed to support two Software Metrics
• Specter of metrics is not broad but base for it is sited
– Supports keeping of source code history
– Supports keeping of calculated values of software metrics
! It analyzes single compilation unit stores to single input file
Contents
Last year…
Motivation (why we did it)
Related work (what others did)
Description (how we did it)
Example (how does it work)
Conclusion and results.
Future work
Future work
• Adding support for additional PLs– Ancient PLs – COBOL(almost done) and Fortran ?!
• JUMPS are still open questions here !!!• Support for COBOL is to be tested !!!
• Adding support for additional Software Metrics– For OO metrics relationships between compilation units are
needed !
• Interpret calculated metric values– Represent them graphically– Interpret their meaning in order to provide useful information
to the user