The zero-error channel capacity is the maximum asymptotic rate that can be reached with error probability exactly zero, instead of a vanishing error probability. The nature of this problem, essentially combinatorial rather than probabilistic, has led to various researches both in Information Theory and Combinatorics. However, the zero-error capacity is still an open problem, for example the capacity of the noisy-typewriter channel with 7 letters is unknown.In this article, we propose a new approach to construct optimal zero-error codes, based on the concatenation of words of variable-length, taken from a generator set. Three zero-error variable-length coding schemes, referred to as "variable-length coding", "intermingled coding" and "automata-based coding", are under study. We characterize their asymptotic performances via linear difference equations, in terms of simple properties of the generator set, e.g. the roots of the characteristic polynomial, the spectral radius of an adjacency matrix, the inverse of the convergence radius of a generator series. For a specific example, we construct an "intermingled" coding scheme that achieves asymptotically the zero-error capacity.