Data Flow Graph Structure

I was asked to write a program to plot the data stream of the input program code taking into account the abstract syntax tree. I am looking for a definition of a data flow graph online and found that there are many things in analyzing the data flow of a code segment. I want to know what exactly I need to do to build a data flow graph for a given code. Any help is much appreciated!

+4
source share
1 answer

Given AST, to create a data flow graph, you should:

  • create symbol tables so that each identifier used is mapped to its explicitly or implicitly defined type, also allowing you to distinguish an identifier in one scope from the same identifier in another area

  • plot the flow of control by showing the execution order of program code and conditional branches. (Bonus points for plotting calls between functions!)

  • determine how the data flows along the schedule of the control flow, usually using some kind of mechanism for analyzing the data flow , creating links to the lifetime variable and capturing all of this in the form of a graph.

You can draw the final plot using some kind of external drawing package.

All of these steps are quite complex and are likely to work a lot more than you might think. I get the impression that you don't have much experience here. You can get this background by looking at the standard compiler text (Aho / Sethi / Ullman compilers), quite classic and very good. But you need to do this before you start, or you won’t understand the steps and they will come together.

+6
source

All Articles