How to define a language using PROLOG

  • Authors:
  • Chris D.S. Moss

  • Affiliations:
  • -

  • Venue:
  • LFP '82 Proceedings of the 1982 ACM symposium on LISP and functional programming
  • Year:
  • 1982

Quantified Score

Hi-index 0.00

Visualization

Abstract

There have been many papers, conferences and theses concerned with the task of defining programming languages. Yet, twenty years after McCarthy's (1962) seminal paper there is still no widely accepted method which will deal with all parts of a language clearly and concisely. Everyone who invents a language writes a BNF definition and the more theoretically minded will attempt a denotational semantics. For a complete definition of the syntax, attribute grammars are gaining increasing acceptance while more practically minded language designers will use one of the compiler definition languages such as Meta4 or CDL. At the same time as the PROLOG language was defined, a grammar system called Metamorphosis Grammar (M-grammar for short) was invented by Colmerauer (1978). This has been shown to be suitable (Moss 1981) for defining both the full syntax and semantics of programming languages. The present paper attempts to give an overview of this method in the form of a practical guide to writing a language definition. This includes the context sensitive syntax, and semantics using denotational, relational or axiomatic methods. This definition is not simply of theoretical interest. Since PROLOG is a practical programming language, though with a sound theoretical basis (Warren, Pereira, Pereira 1977), the definition can be used as a prototyping tool for a new language. With the addition of plan-formation techniques one might form a PROLOG based compiler generator and by adding other axioms form a program proving system.