Skip to content
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

Support for COBOL CFG display with graphviz and d3 #368

Merged
merged 40 commits into from
Oct 22, 2024

Conversation

NeoKaios
Copy link
Contributor

@NeoKaios NeoKaios commented Sep 9, 2024

  • Adds ocaml-graph dependency to generated a dot graph of the CFG of a COBOL program / section
  • Adds 2 commands to acces a dot svg graph and a arc-reprensentation of the CFG via Vscode webviews
  • Adds context menus to access those graphs

src/lsp/cobol_cfg/cfg_builder.ml Outdated Show resolved Hide resolved
src/lsp/cobol_lsp/lsp_request.ml Outdated Show resolved Hide resolved
src/lsp/superbol_free_lib/vscode_extension.ml Outdated Show resolved Hide resolved
src/lsp/cobol_cfg/cobol_cfg.ml Outdated Show resolved Hide resolved
assets/cfg-dot-renderer.html Outdated Show resolved Hide resolved
assets/cfg-dot-renderer.html Outdated Show resolved Hide resolved
assets/cfg-d3-renderer.html Outdated Show resolved Hide resolved
assets/cfg-dot-renderer.html Outdated Show resolved Hide resolved
assets/cfg-dot-renderer.html Outdated Show resolved Hide resolved
src/lsp/cobol_cfg/cfg_jumps.ml Show resolved Hide resolved
src/lsp/cobol_cfg/cfg_builder.mli Outdated Show resolved Hide resolved
src/lsp/cobol_cfg/cfg_builder.mli Outdated Show resolved Hide resolved
src/lsp/cobol_cfg/cfg_builder.ml Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only skimmed through this file, which appears fine as a draft. Some changes will be needed (possibly later) to avoid doing the actual export in this library (which should mostly be about internal CFG representation and construction, with possibly a Cobol_cfg.As_dot module which may be helpful in other contexts).

src/lsp/cobol_cfg/cfg_options.ml Outdated Show resolved Hide resolved
shatter_hubs: int option;
transformation: transformation option;
hidden_nodes: int list;
split_nodes: int list;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note sure what those two last lists correspond to. What do the ints correspond to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They correspond to node ids

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment to specify where these IDs come from? Do they come from a previous CFG construction? (there's an integrity issue here, but that may still be ok for now).

Lsp_cfg.doc_to_cfg_jsoono ~filename:uri ~name ~options checked_doc
in Some jsoono
end |>
Option.get
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why there's a need for Option.get here. Like most other requests the payload of replies should also be made optional to account for improper uses of the requests, and those cases dealt with on the client side.

(That'll be fixed later though)

@nberth
Copy link
Collaborator

nberth commented Oct 22, 2024

@NeoKaios Could you just add the "Added: CFG explorer for COBOL programs" in CHANGELOG.md? Then we can merge.

@nberth
Copy link
Collaborator

nberth commented Oct 22, 2024

Thanks!

@nberth nberth merged commit 71275bf into OCamlPro:master Oct 22, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants