The electronic structure and the optical properties of α-Si3N4, β-Si3N4, and Si2N2O crystals are studied by means of first-principles local-density calculations. Together with the earlier published result on α-SiO2, a comparative study of the electronic bonding and optical excitations in these crystals becomes possible. It is found that the electronic structure of the β and the α phases of Si3N4 are similar, but with some subtle differences that can be traced to different stacking sequences of the atomic layers and the slightly different local bonding structure. The electronic structure of the Si2N2O crystal cannot be adequately described as a simple superposition of Si3N4 and α-SiO2. The presence of both Si-N and Si-O bonds in Si2N2O crystals affects the local potential and results in a downward shift of the O levels. The calculated density of states (DOS) and the orbital-resolved partial DOS are in good general agreement with the photoemission and x-ray emission measurements. Better resolution in the calculated DOS shows that the upper valence band has five peaks rather than three. Effective charge calculation suggests the ionic formulas of the four crystals to be α-(Si+2.52)3(N-1.89)4, β-(Si+2.50)3(N-1.87)4, α-(Si+2.60)(O-1.30)2, and (Si+2.54)2(N-1.90)2(O-1.25). The calculated optical properties of the four crystals show similar features in the gross absorption spectra but with differences in the peak positions. It is shown that all four crystals have intrinsic absorption tails, and those of Si2N2O and α-SiO2 are larger than those of α-Si3N4 and β-Si3N4. This is explained by the nature of the wave function at the conduction-band minimum. The difference in the intrinsic band gap and the extrapolated optical gap is pointed out. Comparison with experimental data on amorphous Si3N4 shows good agreement with the optical conductivity of the crystalline phases. It is also shown that Si2N2O and α-SiO2 crystals have negligible optical anisotropy, while for α-Si3N4 and β-Si3N4 the in-plane component of the dielectric function in the long-wavelength limit is smaller than the corresponding component parallel to the c axis. The calculated refractive indices are in good agreement with the limited data available. © 1995 The American Physical Society.