Motivated by L\'evy's characterization of Brownian motion on the line, we propose an analogue of Brownian motion that has as its state space an arbitrary unbounded closed subset of the line: such a process will a martingale, has the identity function as its quadratic variation process, and is ``continuous'' in the sense that its sample paths don't skip over points. We show that there is a unique such process, which turns out to be automatically a Feller-Dynkin Markov process. We find its generator, which is a natural generalization of the operator $f \mapsto \frac{1}{2} f''$.

We then consider the special case where the state space is the self-similar set $\{\pm q^k : k \in \Z\} \cup \{0\}$ for some $q>1$. Using the scaling properties of the process, we represent the Laplace transforms of various hitting times as certain continued fractions that appear in Ramanujan's ``lost'' notebook and evaluate these continued fractions in terms of basic hypergeometric functions (that is, $q$-analogues of classical hypergeometric functions). The process has $0$ as a regular instantaneous point, and hence its sample paths can be decomposed into a Poisson process of excursions from $0$ using the associated continuous local time. Using the reversibility of the process with respect to the natural measure on the state space, we find the entrance laws of the corresponding It\^o excursion measure and the Laplace exponent of the inverse local time -- both again in terms of basic hypergeometric functions. By combining these ingredients, we obtain explicit formulae for the resolvent of the process. We also compute the moments of the process in closed form. Some of our results involve $q$-analogues of classical distributions such as the Poisson distribution that have appeared elsewhere in the literature.