a short introduction to Prolog, and Logic Grammars with constraints as an easy way to Syntax and Semantics
This article gives a short introduction on how to get started with logic pro- gramming in Prolog that does not require any previous programming expe- rience. The presentation is aimed at students of linguistics, but it does not go deeper into linguistics than any student who has some ideas of what a computer is, can follow the text. I cannot, of course, cover all aspects of logic programming in this text, and so we give references to other sources with more details. Students of linguistics must have a very good motivation to spend time on programming, and I show here how logic programming can be used for modelling different linguistic phenomena. When modelling language in this way, as opposed to using only paper and pencil, your models go live: you can run and test your models and you can use them as automatic language analyzers. This way you will get a better understanding of the dynamics of languages, and you can check whether you model expresses what you intend. Based on Prolog, I also introduce Deﬁnite Clause Grammars which is in- tegrated in most Prolog systems: You can write a grammar in a straightfor- ward notation, perhaps include different syntactic, semantic and pragmatic features – and with no additional effort, you can use it as an automatic language analyzer. I show also another important extension to Prolog, called Constraint Handling Rules, which boosts these grammars with capabilities for captur- ing semantics and pragmatics by abductive reasoning, in a way that I claim is considerably simpler than mainstream formalisms; this part is to a large extent based on my own research. Hardcore linguists may object that these approaches are too simplistic – and they are right (of course, they are always right ;-) – but this simplicity, I will reply, provides exposure to linguistic phenomena in a clariﬁed and distilled form which is difﬁcult to obtain by other means. Finally I apologize for any errors, omissions, misspellings and mistakes, which I’m sure there are plenty of, as this article has been produced in a very short time. I am glad to receive any comments and questions. All example programs can be downloaded from the following website: http://www.ruc.dk/∼henning/LP-for-Linguists.