Open baltaci-r opened 2 years ago
Hi @baltaci-r , yes, I think analyzing the control flow of a COBOL program should be possible based on this repo. The abstract semantic graph contains static information about called paragraphs, data description read and write access etc.
This is repo is only the pure parser, i.e. a CFG generator would have to be developed. However, we did something comparable by writing COBOL pattern analysis rules for another project. If interested, let me know and we can take a look.
Yes, this seems interesting. Can you share more details on a COBOL CFG?
Hello @sundar7D0 ,
yes, in the meantime we published the pattern analysis source code. You can find it in this repo https://github.com/proleap/proleap-cobol
Best
Thanks for the prompt reply! My use-case is this where I want to convert a COBOL source code in a visualisable control flow graph, similar to this https://github.com/BroadcomMFD/cobol-control-flow. Is it possible with the tool you mentioned?
No, this is not possible with the code mentioned. Instead the code mentioned provides rules, which analyze the sorce code for patterns.
Such functionality is not implemented based on ProLeap, yet. However, it could be done quite easily, as the abstract semantic graph (ASG) contains all relevant information.
Can it be done even at the level of if-else within a function? What's the lowest level of granularity?
The lowest level of granularity is an individual token of the parser. So, yes, branches of IF statements are definitely contained in the ASG.
Ok great! I understood what's to be done. But I was looking for a solution which is tightly related to the original code-snippets; creating a control flow graph like described here: https://modeling-languages.com/wp-content/uploads/2013/09/paper-cameraready.pdf
Are you aware of any open-source tools that can already do this?
Hi, no, unfortunately I do not know such tools. I think it would be possible to rebuild the tool from the paper as the complete information is contained in the AST and ASG. In the end one would need to identify all next statements after a statement, and build a flow graph -> quite simply, should be doable in several days including assigning code fragments to the control flow graph nodes. The optical rendering or integration into an IDE would be a separate topic.
In case this is for a company feel free to contact me via email. Perhaps a cloud service or so could be build for this...
Thanks a lot uwol for your prompt response so far! I will get back to you if required. We are planning something open-source with COBOL modernisation, so will keep you posted
@sundar7D0 did you got any solution for the flow.
Can this repo be extended to generate CFGs for COBOL?