Is this a form of Data Flow Analysis, and what is the proper way solution to the problem?

"Oliver Wong" <owong@castortech.com>
12 Jan 2006 12:12:58 -0500

          From comp.compilers

Related articles
Is this a form of Data Flow Analysis, and what is the proper way solut owong@castortech.com (Oliver Wong) (2006-01-12)
Re: Is this a form of Data Flow Analysis, and what is the proper way s gneuner2@comcast.net (George Neuner) (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s henry@spsystems.net (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s paolo.bonzini@gmail.com (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s owong@castortech.com (Oliver Wong) (2006-01-20)
Re: Is this a form of Data Flow Analysis, and what is the proper way s gneuner2@comcast.net (George Neuner) (2006-01-26)
[4 later articles]
| List of all articles for this month |

From: "Oliver Wong" <owong@castortech.com>
Newsgroups: comp.compilers
Date: 12 Jan 2006 12:12:58 -0500
Organization: GlobeTrotter
Keywords: analysis, question
Posted-Date: 12 Jan 2006 12:12:58 EST

        First off, I'd like to mention that while I took a university level
course in compiler construction, it was relatively introductory, and I'm not
familiar with some of the theory and terminology I am coming across in my
search for an answer. If I used the wrong term for a concept, I apologize.


        I'd like to do some analysis on the source code of a Java program. I've
got the code parsed into an AST, and I've got a primitive symbol table
built. I'd like to determine, for a given write-operation, what names (from
the symbol table) affect the value to be written. For example, in the
following statement:


x = y + 5 + z;


        The value written to 'x' depends on both the value of 'y' and the value
of 'z'. Specifically, the output of my program is something like:


* There is a write to x.
* There is a read from y, which leads to a write to x.
* There is a read from z, which leads to a write to x.


        Note that the of the statements in the output is generally unimportant
for now, and in the actual program, line and column numbers are given to
reveal exactly what statement in the source code is being referred to. My
question is a conceptual one. In the statement:


z = y = x;


        Which of the following outputs would be more "correct"?


* There is a read from x, which leads to a write to y.
* There is a write to y.
* There is a read from y, which leads to a write to z.
* There is a write to z.


OR


* There is a read from x, which leads to a write to y.
* There is a read from x, which leads to a write to z.
* There is a write to y.
* There is a write to z.


        Is there a general consensus, one way or the other? Is there a name for
what it is I'm trying to do? I've encountered the term "Data Flow Analysis",
but the examples of DFAs I've seen only seen marginally related to what I'm
doing.


        - Oliver


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.