STEPAR: an automatic code to infer stellar atmospheric parameters