Complex sentence: In the Middle Ages, the walls hemmed the town in, on all sides, built at the foot of the castle, the oldest mention of which goes back to the same century.
Split into simpler sentences: In the Middle Ages, the walls hemmed the town in on all sides. They were built at the foot of the castle, the oldest mention of which goes back to the same century.