A Prological Definition or HASL a Purely Functional Language with Unification Based Conditional Binding Expressions

ID
TR-83-08
Authors
Harvey Abramson
Publishing date
January 1983
Abstract

We present a definition in Prolog of a new purely functional (applicative) language HASL ({\em HA}rvey's {\em S}tatic {\em L}anguage). HASL is a descendant of Turner's SASL and differs from the latter in several significant points: it includes Abramson's unification based conditional binding constructs; it restricts each clause in a definition of a HASL function to have the same arity, thereby complicating somewhat the compilation of clauses to combinators, but simplifying considerably the HASL reduction machine; and it includes the single element domain \{fail\} as a component of the domain of HASL data structures. It is intended to use HASL to express the functional dependencies in a translator writing system based on denotational semantics, and to study the feasibility of using HASL as a functional sublanguage of Prolog or some other logic programming language. Regarding this latter application we suggest that since a reduction mechanism exists for HASL, it may be easier to combine it with a logic programming language than it was for Robinson and Siebert to combine LISP and LOGIC into LOGLISP: in that case a fairly complex mechanism had to be invented to reduce uninterpreted LOGIC terms to LISP values.

The definition is divided into four parts. The first part defines the lexical structure of the language by means of a simple Definite Clause Grammar which relates character strings to "token" strings. The second part defines the syntactic structure of the language by means of a more complex Definite Clause Grammar and relates token strings to a parse tree. The third part is semantic in nature and translates the parse tree definitions and expressions to a variable-tree string of combinators and global names The fourth part of the definition consists of a set of Prolog predicates which specifies how strings of combinators and global names are reduced to "values", ie., integers, truth values, characters, lists, functions fail, and has an operational flavour: one can think of this fourth part as the definition of a normal order reduction machine.