A Compiler for Natural Semantics

Natural semantics is a formalism used for specifying both semantics and implementations of programming languages. Until recently, no practical implementation of the formalism existed. We have defined the Relational Meta-Language, RML, as an executable specification language for natural semantics. After a brief outline of the language, we describe the compilation strategy used by our rml2c compiler: transformations are applied to minimize non-determinism, and a continuationpassing style form is produced and simplified. Finally the CPS is emitted as low-level C code, using an efficient technique for implementing tailcalls. We also present performance measurements that support our choice of compilation strategy.

[1]  G BakerHenry CONS should not CONS its arguments, part II , 1995 .

[2]  Peter Lee,et al.  No assembly required: compiling standard ML to C , 1992, LOPL.

[3]  Bogumil Hausman Turbo Erlang: Approaching the Speed of C , 1993, ICLP-Workshops on Implementation of Logic Programming Systems.

[4]  Fergus Henderson,et al.  The Implementation of Mercury, an Efficient Purely Declarative Logic Programming Language , 1994, ILPS Workshop: Implementation Techniques for Logic Programming Languages.

[5]  Thierry Despeyroux,et al.  Executable Specification of Static Semantics , 1984, Semantics of Data Types.

[6]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[7]  Robin Milner,et al.  Definition of standard ML , 1990 .

[8]  Yuri Gurevich,et al.  Logic in Computer Science , 1993, Current Trends in Theoretical Computer Science.

[9]  Hassan Aït-Kaci,et al.  Warren's Abstract Machine: A Tutorial Reconstruction , 1991 .

[10]  Gillier,et al.  Logic for Computer Science , 1986 .

[11]  John Hannan,et al.  Investigating a proof-theoretic meta-language for functional programs , 1990 .

[12]  Mikael Pettersson,et al.  RML - A New Language and Implementation for Natural Semantics , 1994, PLILP.

[13]  Guy L. Steele,et al.  A compiler for scheme (a study in compiler optimization) , 1978 .

[14]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[15]  Takashi Chikayama,et al.  A Portable and Efficient Implementation of KL1 , 1994, PLILP.

[16]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.

[17]  Philippe Codognet,et al.  WAMCC: Compiling Prolog to C , 1995, ICLP.

[18]  Joëlle Despeyroux,et al.  Proof of Translation in Natural Semantics , 1986, LICS.

[19]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[20]  Koen De Bosschere,et al.  jc: An Efficient and Portable Sequential Implementation of Janus , 1992, JICSLP.

[21]  Wayne Snyder,et al.  Theorem Proving Using Rigid E-Unification Equational Matings , 1987, LICS.

[22]  Henry G. Baker,et al.  CONS should not CONS its arguments, part II: Cheney on the M.T.A. , 1995, SIGP.

[23]  Mikael Pettersson,et al.  A Term Pattern-Match Compiler Inspired by Finite Automata Theory , 1992, CC.

[24]  Didier Parigot,et al.  Integrating Natural Semantics and Attribute Grammars : the Minotaur System , 1993 .