Skip to main content
Log in

A prological definition of HASL a purely functional language with unification based conditional binding expressions

  • Regular Papers
  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

We present a definition in Prolog of a new purely funtional (applicative) language HASL (HArvey’s StaticLanguage). 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-free 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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Abramson, H. “Unification-based Conditional Binding Constructs”, Proceedings First International Logic Programming Conference (Marseille, 1982).

  2. Abramson, H.: “A Prolog Implementation of SASL”, Logic Programming Newsletter,4 (Winter 1982/1983).

  3. Burge, W. H.: “Recursive Programming Techniques” (Addison-Wesley, 1975).

  4. Colmerauer, A.: “Metamorphosis Grammars”, in Natural Language Communication with Computers, Lecture Notes in Computer Science,63 (Springer, 1978).

  5. Curry, H. B. & Feys, R.: “Combinatory Logic Volume I”, (North-Holland Publishing Company, 1958).

  6. Henderson, P. & Morris, J. H.: “A lazy evaluator”, Conference Record of the 3rd ACM Symposium on Principles of Programming Languages (1976) 95–103.

  7. Moss, C. D. S.: “A Formal Description of ASPLE Using Predicate Logic”, DOC 80/18 (Imperial College, London, 1979).

    Google Scholar 

  8. Moss, C. D. S.: “The Formal Description of Programming Languages using Predicate Logic”, Ph. D. Thesis (Imperial College, 1981).

  9. Moss, C. D. S.: “How to Define a Language Using Prolog”, Conference Record of the 1982 ACM Symposium on Lisp and Functional Programming (Pittsburgh, Pennsylvania, 1982) 67–73.

  10. Mosses, Peter: “SIS—Semantics Implementation System: Reference Manual and User Guide”, DAIMI MD-30 (Computer Science Department, Aarhus University, Denmark, 1979).

    Google Scholar 

  11. Pereira, F. C. N. (ed.): “C-Prolog User’s Manual”, (University of Edinburgh, Department of Architecture, 1982).

  12. Pereira, F. C. N. & Warren, D. H. D.: “Definite Clause Grammars for Language Analysis”, Artificial Intelligence,13 (1980) 231–278.

    Article  MATH  MathSciNet  Google Scholar 

  13. Robinson, J. A. & Siebert, E. E.: “LOGLISP—an alternative to Prolog” (School of Computer and Information Science, Syracuse University, 1980).

  14. Robinson, J. A. & Siebert, E. E.: “Logic Programming in LISP” (School of Computer and Information Science, Syracuse University, 1980).

  15. Turner, D. A.: “SASL Language Manual” (Department of Computational Science, University of St. Andrews, 1976, revised 1979).

  16. Turner, D. A.: “A new implementation technique for applicative languages”, Soft-ware—Practice and Experience,9 (1979) 31–49.

    Article  MATH  Google Scholar 

  17. Turner, D. A.: “Aspects of the Implementation of Programming Languages: The Compilation of an Applicative Language to Combinatory Logic”, Ph. D. Thesis (Oxford, 1981).

  18. Warren, David H. D.: “Logic programming and compiler writing”, DAI Research Report,44 (University of Edinburgh, 1977).

Download references

Author information

Authors and Affiliations

Authors

About this article

Cite this article

Abramson, H. A prological definition of HASL a purely functional language with unification based conditional binding expressions. NGCO 2, 3–35 (1984). https://doi.org/10.1007/BF03037050

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037050

Keywords

Navigation