It is definitely caused by sugar and particularly sodas and sugary drinks. The mouth is a great place for bacteria. Bacteria loves to eat sugar and when they eat sugar, they excrete an acidic sticky substance that becomes a film. This film will rot the shit out of your teeth. If you don't eat / drink too much sugar, brush / floss regularly, your teeth will last for a damn long time.