  We consider a symbolic coding of linear trajectories in the regular octagon
with opposite sides identified (and more generally in regular 2n-gons). Each
infinite trajectory gives a cutting sequence corresponding to the sequence of
sides hit. We give an explicit characterization of these cutting sequences. The
cutting sequences for the square are the well studied Sturmian sequences which
can be analyzed in terms of the continued fraction expansion of the slope. We
introduce an analogous continued fraction algorithm which we use to connect the
cutting sequence of a trajectory with its slope. Our continued fraction
expansion of the slope gives an explicit sequence of substitution operations
which generate the cutting sequences of trajectories with that slope. Our
algorithm can be understood in terms of renormalization of the octagon
translation surface by elements of the Veech group.
