A question about translating procedural languages

Jeff.VanBaalen@uwyo.edu (Jeffrey Van Baalen)
Date: 28 Apr 1993 10:24:15 -0600 (MDT)
From: Jeff.VanBaalen@uwyo.edu (Jeffrey Van Baalen)
Subject: A question about translating procedural languages
To: interlingua@ISI.EDU
Message-id: <9304281624.AA01015@moran.cs>
Content-Transfer-Encoding: 7BIT

Given the esoteric nature of recent submissions to this mailing list,
please let me apologize in advance for how grungy this question is.
It is a question for someone who knows more than us about the
denotational semantics of programming languages.

We are working on an EXPRESS to KIF translator and, not surprisingly,
we have run into some interesting issues in translating the procedural
part of EXPRESS.  Consider the following example which contains a
simple function definition in EXPRESS followed by our best attempt at
a translation into KIF.

function years (birthday: date): integer;
  local current: date := 1993;
  if (birthday < current) then
  else return(current - birthday);

(and (integer (years ?x))
     (= years (lambda (?birthday)
		(if (date ?birthday)
		    ((lambda (?current)
		       (and (date ?current)
			    (if (< ?birthday ?current)
			        (- ?current ?birthday))))

First, we would like to know if this KIF expression a reasonable
translation of the EXPRESS function definition.

In addition, we have the following specific concerns: The function is
undefined if its input is not a date.  This seems to us to capture the
intention when declaring the type of a formal parameter.  We have
handled "typing" ?current in a similar way.  Here we are less sure
whether we have captured the intent because, we think that in EXPRESS,
by declaring ?current to be a date, it could inherit properties from a
supertype of date.  Perhaps the same thing is true of ?birthday.