This paper presents a shape grammar that formalizes the architectural form of ancient Greek and Roman libraries and encodes it into shape rules for the reconstruction, evaluation and prediction of ancient Greek and Roman libraries.The grammar is briefly presented and the different contributions of the computation to archaeological research are discussed.