Polymeric precursors for producing graphene nanoribbons and methods for preparing them