Discrete, compositional, and symbolic representations through attractor dynamics