Browse Prior Art Database

Language Conversion Based on Abstract Syntax

IP.com Disclosure Number: IPCOM000077986D
Original Publication Date: 1972-Oct-01
Included in the Prior Art Database: 2005-Feb-25
Document File: 4 page(s) / 116K

Publishing Venue

IBM

Related People

Diel, H: AUTHOR [+3]

Abstract

This description provides a conversion program which is independent of the underlying languages. A general conversion program must include the syntax of the languages to be converted from and into. The program shown here requires a description of the so-called abstract syntax of the two languages.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 51% of the total text.

Page 1 of 4

Language Conversion Based on Abstract Syntax

This description provides a conversion program which is independent of the underlying languages. A general conversion program must include the syntax of the languages to be converted from and into. The program shown here requires a description of the so-called abstract syntax of the two languages.

A table representing this abstract syntax is introduced and it is shown how the (concrete) syntax can be related to the abstract syntax. Finally, an algorithm is described which translates a program written in a language L1 into an L2 program, if the (concrete) syntaxes of the two languages can be related to the same abstract syntax and certain additional requirements are fulfilled.

The structure of the Abstract Syntax Table (As-Table) is as follows: 1) AS- table is an array of so-called AS-objects 2) AS=object is an array of pointers to AS-alternatives 3) An AE-alternative is either (a) a list of indexes to AS-objects, or (b) the indication of an elementary object. A distinction is made between two types of elementary objects; those which have to be associated with a value and those whose only value is already given by the AS alternative they represent. The first type is indicated by the character @ , and the latter type by index 0.

The structure of the above AS-table indicates a known manner in which the abstract syntax of a certain language can be described, namely, by regarding a program written in that language as a "composite object" A "composite object" here means an object which may appear in one of several alternative representations, each of these alternative representations consisting either of an elementary object or a list of other composite objects.

Two languages have an identical abstract syntax for the algorithms given below if their AS-tables are identical, except that the associated syntax may be different, and the meaning of any two corresponding AS-objects and any two corresponding AS-alternatives for both AS-tables is the same. Whereas it is simple to formally prove the first condition, there is no formal way (at least not for this disclosure) in which the latter condition can be proved.

A concrete syntax (a syntax in a general sense) is associated with an abstract syntax in the following way:

A syntax description is associated with each AS-alternative. This means in the AS-table an AS-alternative consists of the information as described above, plus a syntax description.

This syntax description consists of operations known from general syntax notations (e.g., BNF). addition, the operations "Substitute syntax from AS-object
(K)" and "Substitute elementary object" may appear. The operation "Substitute elementary object" is followed by the name of the routine performing the syntax check for this specific elementary object. Rules for applying the two new operations are:.

Substitute syntax from AS-object (K)" may appear in syntax descriptions for those AS-alternatives whose lis...