Skip to main content
eScholarship
Open Access Publications from the University of California

A Semantic Formalism and Associated Semantic Process for the Specification and Translation of Programming Languages

Abstract

Definitions of the semantics of programming languages are often incomplete and ambiguous. In particular, it may be difficult to determine what action is intended by a particular construct in some language. As a consequence, different implementations of that language may produce different results.

To help eliminate those differences which result from incomplete and ambiguous language definitions, a formalism for semantic specification and a semantic process are introduced. A semantic specification for a programming language can be viewed as a set of state transformations. The semantic process applies these state transformations to a program represented as a tree indicating the program structure and produces a computation tree representing the meaning of the program.

The semantic process can be viewed as part of a generalized table-driven translator for programming languages. Although such a translator may not be particularly efficient, its use produces translations which are consistent with the semantic specification and thus match the intent of the specifier. As a tool, the translator can be particularly useful for language debugging and tuning.

To illustrate the use of the semantic formalism, a semantic specification for Algol 60 and the results of its application to several Algol 60 constructs are given. A semantic process coded in Lisp and a cross-reference for the semantic specification by syntactic construct are also given.

Main Content
For improved accessibility of PDF content, download the file to your device.
Current View