Re: intelligent diff? (Michael Spertus)
15 Jun 1997 22:37:01 -0400

          From comp.compilers

Related articles
inteligent diff? (Norman Hilton) (1997-06-13)
Re: intelligent diff? (1997-06-15)
Re: intelligent diff? (1997-06-24)
| List of all articles for this month |

From: (Michael Spertus)
Newsgroups: comp.compilers
Date: 15 Jun 1997 22:37:01 -0400
Organization: Dept. of Mathematics
References: 97-06-058
Keywords: question, parse

Norman Hilton <> wrote:
>I have a yacc-based processor for the language, which builds
>trees and then walks them. I could imagine building trees for
>the old and new versions and then comparing. Does anyone
>have algorithms for telling whether nodes have been added
>or deleted when a difference occurs?

I haven't written this in code so tell me how it works out.

A tree can be regarded as a list in some order so we are diffing a
list. I prefer to say we are diffing a list of the top level members
then recursively calling diff within that.

First find all unique members. Matching unique members are the
same. For each matching unique member look at the surrounding members,
if they match they are the same. When you are done anything different
is different.

But dealing with trees when you declare members as matching run diff
on their children. In displaying results show the full tree
relationship of all differences.

Post a followup to this message

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