Parse declarations and check types.