<p style='text-indent:20px;'>The theory of linear codes over finite rings has been generalized to linear codes over infinite rings in two special cases; the ring of <inline-formula><tex-math id="M2">\begin{document}$ p $\end{document}</tex-math></inline-formula>-adic integers and formal power series ring. These rings are examples of complete discrete valuation rings (CDVRs). In this paper, we generalize the theory of linear codes over the above two rings to linear codes over complete local principal ideal rings. In particular, we obtain the structure of linear and constacyclic codes over CDVRs. For this generalization, first we study linear codes over <inline-formula><tex-math id="M3">\begin{document}$ \hat{R}_{ \frak m} $\end{document}</tex-math></inline-formula>, where <inline-formula><tex-math id="M4">\begin{document}$ R $\end{document}</tex-math></inline-formula> is a commutative Noetherian ring, <inline-formula><tex-math id="M5">\begin{document}$ \frak m = \langle \gamma\rangle $\end{document}</tex-math></inline-formula> is a maximal ideal of <inline-formula><tex-math id="M6">\begin{document}$ R $\end{document}</tex-math></inline-formula>, and <inline-formula><tex-math id="M7">\begin{document}$ \hat{R}_{ \frak m} $\end{document}</tex-math></inline-formula> denotes the <inline-formula><tex-math id="M8">\begin{document}$ \frak m $\end{document}</tex-math></inline-formula>-adic completion of <inline-formula><tex-math id="M9">\begin{document}$ R $\end{document}</tex-math></inline-formula>. We call these codes, <inline-formula><tex-math id="M10">\begin{document}$ \frak m $\end{document}</tex-math></inline-formula>-adic codes. Using the structure of <inline-formula><tex-math id="M11">\begin{document}$ \frak m $\end{document}</tex-math></inline-formula>-adic codes, we present the structure of linear and constacyclic codes over complete local principal ideal rings.</p>