Implementing Pascal-like constructs : an exercise in Prolog programming