Generation of nonclassical states by nonlinear optical systems