Integrated grating/detector array fabricated in silicon using micromachining techniques