Is there a structure theorem for nonempty, compact, nowhere dense subsets of the real line? Let $X$ be the set of all nonempty compact nowhere dense subsets of the real line.
Is there a theorem that describes the form of the elements of $X$?
Context
For open subsets of the line, such a result is well-known: every open set is the disjoint union of open intervals. But compact sets can be substantially more complicated.
 A: Up to homeomorphism the basic ones are homeomorphic copies of the ordinal space $\alpha+1$ for each $\alpha<\omega_1$, and Cantor sets. Of course $X$ is also closed under finite unions.
Of course a space homeomorphic to one of the countable compact ordinal space can be embedded in a non-obvious way. For example, $\omega^2+1$ can be embedded as follows:
$$f:\omega^2+1\to\Bbb R:\begin{cases}
\omega\cdot n\mapsto\frac1{2^n}\\\\
\omega\cdot n+k\mapsto\frac1{2^{n+1}}-\frac1{2^{n+2+k}},&\text{if }k>0\\\\
\omega^2\mapsto 0\;.
\end{cases}$$
The resulting set of reals looks schematically like this in its order in $\Bbb R$:
$$\bullet\dots\longrightarrow\bullet\longrightarrow\bullet\longrightarrow\bullet\longrightarrow\bullet\longrightarrow\bullet\bullet$$
The bullets ($\bullet$) from right to left are $f(\omega\cdot0),f(\omega\cdot 1),f(\omega\cdot2),\ldots,f(\omega^2)$. This is rather different from our usual picture of $\omega^2+1$ in its natural (ordinal) order.
A: It is the Mazurkiewicz–Sierpiński theorem  combined with the fact that every compact perfect metric space contains a copy of the Cantor set. So in your case, the Mazurkiewicz–Sierpiński theorem applies and all countable, successor ordinals exhaust the homeomorphism type of non-empty compact nowhere-dense subsets of the real line. (All countable ordinals embed into $[0,1]$.)

Stefan Mazurkiewicz and Wacław Sierpiński, Contribution à la topologie des ensembles dénombrables, Fundamenta Mathematicae 1 (1920), 17–27.

It is noteworthy that this theorem appeared in the very first volume of Fundamenta Mathematicae.
