A multiple-scattering technique that Was recently developed to evaluat
e wave diffraction by two superposed gratings is extended to situation
s in which there is an arbitrary number of gratings. In this approach
the diffraction process can be represented in terms of a flow graph th
at serves as a template to construct algorithms for calculating the in
tensity of any diffracted order. We show that such calculations do not
require a large computer memory if they are implemented by judiciousl
y tracking the relevant diffracted order throughout the flow paths, Us
ing two types of typical grating structures as examples, we also inves
tigate the effect of the relative grating phase on the diffraction eff
iciency. We thus find that the multiple-scattering analysis can readil
y identify those grating structures that are sensitive to the relative
phase relationship.