Most textbooks classify coal as a sedimentary rock even though it does not fit the definition of a sedimentary rock. While a sedimentary rock is a "rock formed from the products of weathering and erosion", coal forms from the remains of land plants. In fact, coal doesn't even fit the definition of a rock. A rock is defined as "mixture of minerals" and minerals are defined as "natural occurring, solid, inorganic substances ..• " Coal is composed largely (90+%) of organic substances (macerals) which, by definition, are not minerals. If coal must be classified as a rock, because it forms from a "previously existing rock by the application of heat, pressure, and chemically active fluids", it would best fit the definition of a metamorphic rock. All of this points up the shortcomings of classification systems. Rather than forcing coal to fit a classification scheme in which it does not belong, a better definition is that coal is "a natural-occurring, carbon-rich, combustible solid found in association with terrestrial sedimentary rocks."
Renton, John J. and Repine, Thomas, "Coal Genesis" (2016). Readings and Notes. 5.