Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-tj2md Total loading time: 0 Render date: 2024-04-17T22:02:46.126Z Has data issue: false hasContentIssue false

9 - A Prolog semantics

Published online by Cambridge University Press:  05 June 2012

Get access

Summary

Ashcroft and Wadge [4] have criticized effort spent on describing existing programming languages and have suggested a more active, prescriptive role for denotational semantics in designing languages of the future. Accepting some truth in this, this chapter contains a semantics for Prolog. While there are existing Prologs, plural, logic programming is still a research area and a denotational semantics is one way to investigate variations in it.

Prolog [9] is a programming language based on first-order predicate logic. A Prolog program can be thought of in two ways. It can be taken to be a set of logical assertions or facts about a world or some part of a world. This is the declarative semantics of the program. It can also be taken as a set of procedure definitions which gives its procedural semantics.

The declarative semantics are very elegant in that the program stands for some basic facts and certain other facts that logically follow from them. No side-effects or considerations of the order of evaluation are involved. Unfortunately, to make Prolog run and to make it run efficiently, some programs require side-effects such as input–output and the order of evaluation to be taken into account. This can only be understood procedurally.

Here a denotational semantics of a subset of Prolog is given. This defines the backtracking search and unification processes of Prolog. Later the definition is translated into Algol-68 to form an interpreter. Prolog is still a research language and giving a denotational semantics enables it to be compared with other languages in a uniform framework.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 1987

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • A Prolog semantics
  • L. Allison
  • Book: A Practical Introduction to Denotational Semantics
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139171892.011
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • A Prolog semantics
  • L. Allison
  • Book: A Practical Introduction to Denotational Semantics
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139171892.011
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • A Prolog semantics
  • L. Allison
  • Book: A Practical Introduction to Denotational Semantics
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139171892.011
Available formats
×