Q:

Can someone explain me the use of は and が in this sentence?

田中さんは今日来ますか。
はい、来ますよ。あ、田中さんが 来ました。

 

Does Tanaka san come today?
Yes, he does. Oh, Tanaka san came.

I don't understand the use of が in the second sentence. Can someone help me?

A:

When you describe or report information which is newly discovered by perception that doesn't include assumption or judgement, Japanese grammar requires you to express it as a sentence whose elements are not topicalized, in short, without adding particles like は.
That kind of sentences are called 現象文 or 中立描写文 (Sentence of neutral description). The example of あっ、田中さんが来ました is the case of it.

