From my understanding, it's pretty simple. Heat the coal, without oxygen, hot enough that everything but the pure carbon will turn into a gas (either directly through evaporation, or by forming itself into gasseous compounds). So basically at that point you'd get from the coal all of the gasseous products one would get from combustion except for CO2.
That’s possibly why Daniel Boone moved from Pennsylvania. Coking operation in his front yard. Maybe that came later.