implement emit-ast option ( see issue #10485 )

First try for #10485. Unit/regression tests are missing for now.

Any comments would be appreciated.

JSON generation part is mostly copied from `librustdoc::lib::json_output`.