BRS cohomology and a Feigin-Fuchs representation of Kač-Moody and parafermionic theories