Skip to content

Control Flow Graph #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
baltaci-r opened this issue Feb 25, 2022 · 11 comments
Open

Control Flow Graph #92

baltaci-r opened this issue Feb 25, 2022 · 11 comments

Comments

@baltaci-r
Copy link

Can this repo be extended to generate CFGs for COBOL?

@uwol
Copy link
Owner

uwol commented Feb 25, 2022

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.

@sundar7D0
Copy link

Yes, this seems interesting. Can you share more details on a COBOL CFG?

@uwol
Copy link
Owner

uwol commented Jul 18, 2023

@sundar7D0
Copy link

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?

@uwol
Copy link
Owner

uwol commented Jul 18, 2023

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.

@sundar7D0
Copy link

Can it be done even at the level of if-else within a function? What's the lowest level of granularity?

@uwol
Copy link
Owner

uwol commented Jul 18, 2023

The lowest level of granularity is an individual token of the parser. So, yes, branches of IF statements are definitely contained in the ASG.

@sundar7D0
Copy link

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?

@uwol
Copy link
Owner

uwol commented Jul 18, 2023

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

@sundar7D0
Copy link

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

@GLJay26
Copy link

GLJay26 commented Oct 5, 2023

@sundar7D0 did you got any solution for the flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants