scispace - formally typeset
Open AccessJournal ArticleDOI

Constructive Action Semantics for Core ML

Jørgen Iversen, +1 more
- 11 Dec 2004 - 
- Vol. 11, Iss: 37
TLDR
This work presents a case study in constructive semantic description, a description of Core ML, consisting of a mapping from it to BAS and action semantic descriptions of the individual BAS constructs written in ASDF (Action Semantics Definition Formalism), a formalism specially designed for writing action semantic description of single language constructs.
Abstract
Usually, the majority of language constructs found in a programming language can also be found in many other languages, because language design is based on reuse. This should be reflected in the way we give semantics to programming languages. It can be achieved by making a language description consist of a collection of modules, each defining a single language construct. The description of a single language construct should be language independent, so that it can be reused in other descriptions without any changes. We call a language description framework ``constructive'' when it supports independent description of individual constructs. We present a case study in constructive semantic description. The case study is a description of Core ML, consisting of a mapping from it to BAS (Basic Abstract Syntax) and action semantic descriptions of the individual BAS constructs. The latter are written in ASDF (Action Semantics Definition Formalism), a formalism specially designed for writing action semantic descriptions of single language constructs. Tool support is provided by the ASF+SDF Meta-Environment and by the Action Environment, which is a new extension of the ASF+SDF Meta-Environment.

read more

Content maybe subject to copyright    Report

BRICS
Basic Research in Computer Science
Constructive Action Semantics for
Core ML
Jørgen Iversen
Peter D. Mosses
BRICS Report Series RS-04-37
ISSN 0909-0878 December 2004
BRICS RS-04-37 Iversen & Mosses: Constructive Action Semantics for Core ML

Copyright
c
2004, Jørgen Iversen & Peter D. Mosses.
BRICS, Department of Computer Science
University of Aarhus. All rights reserved.
Reproduction of all or part of this work
is permitted for educational or research use
on condition that this copyright notice is
included in any copy.
See back inner page for a list of recent BRICSReport Series publications.
Copies may be obtained by contacting:
BRICS
Department of Computer Science
University of Aarhus
Ny Munkegade, building 540
DK–8000 Aarhus C
Denmark
Telephone:+45 8942 3360
Telefax: +45 8942 3255
Internet: BRICS@brics.dk
BRICS publications are in general accessible through the World Wide
Web and anonymous FTP through these URLs:
http://www.brics.dk
ftp://ftp.brics.dk
This document in subdirectory RS/04/37/

Constructive Action Semantics for Core ML
Jørgen Iversen, Peter D. Mosses
BRICS
& Department of Computer Science
University of Aarhus
IT-parken, Aabogade 34
DK-8200 Aarhus N, Denmark
j.iversen@brics.dk, pdmosses@brics.dk
December, 2004
Abstract
Usually, the majority of language constructs found in a program-
ming language can also be found in many other languages, because
language design is based on reuse. This should be reflected in the
way we give semantics to programming languages. It can be achieved
by making a language description consist of a collection of modules,
each defining a single language construct. The description of a single
language construct should be language independent, so that it can be
reused in other descriptions without any changes. We call a language
description framework “constructive” when it supports independent
description of individual constructs.
We present a case study in constructive semantic description. The
case study is a description of Core ML, consisting of a mapping from
it to BAS (Basic Abstract Syntax) and action semantic descriptions of
the individual BAS constructs. The latter are written in ASDF (Ac-
tion Semantics Definition Formalism), a formalism specially designed
for writing action semantic descriptions of single language constructs.
Basic Research in Computer Science (www.brics.dk), funded by the Danish National
Research Foundation.
1

Tool support is provided by the ASF+SDF Meta-Environment and by
the Action Environment, which is a new extension of the ASF+SDF
Meta-Environment.
1 Introduction
We will present a case study in the use of a recently-developed approach
to modular definition of programming languages, called Constructive Action
Semantics.
1
The case study consists of a description of the dynamic semantics
of Core ML (the sublanguage of Standard ML [2] obtained by removing the
constructs concerning modules). We have chosen Core ML for this case study
primarily because it is a cleanly-designed, medium-size language, and our
description of it provides substantial evidence that our approach is practical.
The main point of our approach, amply demonstrated by the case study,
is that a description of a complete language should be based on reusable
definitions of individual language features. This requires an extremely high
degree of modularity, and ensures extensibility and modifiability. Moreover,
it significantly lowers the investment of effort required to give a semantic
description of a new language, since no re-description of constructs taken from
previously-described languages is needed. We hope that this will encourage
language designers to use formal semantics for documentation purposes to a
much greater extent than at present [3, 4].
An important feature of our approach is the tool support available for it:
the so-called Action Environment, which is implemented as an extension of
the ASF+SDF Meta-Environment [5, 6]. The Action Environment is still at
an early stage of development, and it does not yet provide full functionality
regarding prototyping, nor other tool generation; nevertheless, we have found
the present version highly useful in connection with the case study, and we
include a brief description of the main features here.
The rest of this section explains and motivates Constructive Action Se-
mantics, mentions related work, and gives an overview of the rest of the
paper.
1
Constructive Action Semantics was referred to as “Incremental” in [1], but a reviewer
found the terminology confusing.
2

Motivation
Although each programming language generally has some quite distinctive
features, it usually also has many features in common with other languages.
This is particularly true for languages in the same family (e.g., C, C++, and
Java), and those related as extensions (e.g., Standard ML and Concurrent
ML [7]). Moreover, some features seem to be almost ubiquitous: examples in-
clude sequencing, conditional, iteration, assignment, procedural abstraction,
and local declarations. There are sometimes differences regarding details of
both the form and intended interpretation of such a feature (e.g., how con-
ditional expressions are written, and whether the conditions are numerical
or boolean), but if we take a ‘feature’ to be an individual abstract construct
together with a particular intended interpretation for it, that exact feature
may often be found in a significant number of different languages.
Typically, a semantic description of a particular feature is given only in
connection with some complete language description, and common features
thus get re-described many times. In most semantic frameworks (includ-
ing the conventional styles of denotational and operational semantics, but
not action semantics) the description of each feature depends critically on
what other kinds of features are included in the described language. Even
when that is not the case, there may still be substantial notational varia-
tion between different descriptions of the same feature. In practice, semantic
descriptions of individual features have seldom been reused verbatim.
Let us call a framework constructive when it supports the independent
definition and use of named modules describing individual language features.
We insist on reuse by reference to names of modules, rather than by copy-
ing, since in the latter case the reader cannot easily see whether the copy
has subsequently been edited or not. Note however that merely introducing
explicit modular structure into a semantic description does not ensure that
it is constructive: the crucial question is whether the bodies of the modules
are independent.
The advantages of a constructive framework are both numerous and sig-
nificant:
an expanding library of independent descriptions of individual language
constructs can be provided;
when describing a new language, no time and effort is wasted on re-
describing familiar constructs;
3

Citations
More filters
Journal Article

A Constructive Approach to Language Definition

TL;DR: The frameworks of Modular SOS and Action Semantics can both be used in conjunction with the proposed approach, and some illustrations are given.
Journal ArticleDOI

An action compiler targeting Standard ML

TL;DR: An action compiler that can be used in connection with an action semantics based compiler generator generator and produces code with faster execution times than code produced by other action compilers, and for some nontrivial test examples it is only a factor of two slower than the Gnu C Compiler.
Journal ArticleDOI

An Action Compiler Targeting Standard ML

TL;DR: An action compiler that can be used in connection with an action semantics based compiler generator generator and produces code with faster execution times than code produced by other action compilers, and for some non-trivial test examples it is only a factor two slower than the Gnu C Compiler.
Book ChapterDOI

An implementation of object-oriented action semantics in Maude

TL;DR: Maude Object-Oriented Action Tool is presented, an executable environment that incorporates elements from Full Maude and Maude MSOS Tool to support constructive (object-oriented) action semantics, and an Object- Oriented action semantics library of classes is presented.