1. In front of the building was a supermarket.

2. In front of the building, was a supermarket.

3. In front of the building a supermarket was.

4. In front of the building, a supermarket was.

(Which ones are grammatical?)

Only 1 is correct.

Thank you for your help.

1. In front of the building was it.

2. In front of the building it was.

(What about these sentences? Which one is grammatical?)

Neither is correct.

Out of the given options, the grammatically correct sentences are:

1. In front of the building was a supermarket.
2. In front of the building, was a supermarket.
4. In front of the building, a supermarket was.

Sentence 1 and Sentence 2 are grammatically correct because they follow the standard word order in English, where the subject (a supermarket) comes after the verb (was) in the sentence.

Sentence 3 is not grammatically correct because it reverses the natural word order of the subject and verb. While it may still be understandable, it sounds less natural.

Therefore, sentences 1, 2, and 4 are grammatically correct options.