Identifying syntactic differences between two programs

Wuu Yang*

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

219 Scopus citations


Programmers frequently face the need to identify the differences between two programs, usually two different versions of a program. Text‐based tools such as the UNIXr̀ utility diff often produce unsatisfactory comparisons because they cannot accurately pinpoint the differences and because they sometimes produce irrelevant differences. Since programs have a rigid syntactic structure as described by the grammar of the programming language in which they are written, we develop a comparison algorithm that exploits knowledge of the grammar. The algorithm, which is based on a dynamic programming scheme, can point out the differences between two programs more accurately than previous text comparison tools. Finally, the two programs are pretty‐printed ‘synchronously’ with the differences highlighted so that the differences are easily identified.

Original languageEnglish
Pages (from-to)739-755
Number of pages17
JournalSoftware: Practice and Experience
Issue number7
StatePublished - 1 Jan 1991


  • cdiff
  • Synchronous pretty‐printing
  • Syntax‐directed comparator

Fingerprint Dive into the research topics of 'Identifying syntactic differences between two programs'. Together they form a unique fingerprint.

Cite this