## Denotational Semantics of Evaluation Order in Expressions with Side Effects (1998)

Venue: | In Recent advances in information science and technology: 2nd part of the proceedings of the 2nd IMACS international conference on circuits, systems and |

Citations: | 2 - 0 self |

### BibTeX

@INPROCEEDINGS{Papaspyrou98denotationalsemantics,

author = {Nikolaos S. Papaspyrou},

title = {Denotational Semantics of Evaluation Order in Expressions with Side Effects},

booktitle = {In Recent advances in information science and technology: 2nd part of the proceedings of the 2nd IMACS international conference on circuits, systems and},

year = {1998},

publisher = {World Scientific}

}

### OpenURL

### Abstract

The presence of side effects in even a very simple language of expressions gives rise to a number of semantic questions. The issue of evaluation order becomes a crucial one and, unless a strict order is enforced, the language becomes non-deterministic. In this paper we study the semantics of such a language under a variety of possible evaluation strategies, from simpler to more complex, concluding with unspecified evaluation order, unspecified order of side effects and the mechanism of sequence points that is particular to the ANSI C programming language. In doing so, we adopt the denotational semantics approach and use monads to improve modularity and to reduce the number of changes required for each transition. The result is a better understanding of different evaluation strategies, possibly leading to non-determinism in the presence of side effects, and a unified way of specifying their semantics. Furthermore, a significant step is achieved towards a correct denotational semantics f...

### Citations

1399 |
A Discipline of Programming
- Dijkstra
- 1976
(Show Context)
Citation Context ...essions is a source of non-deterministic behaviour. The formal semantics of pure expressions can most of the times be easily specified in operational [Henn90], denotational [Stoy77] or axiomatic form =-=[Dijk76]-=-. The introduction of side-effects implies serious complications in the axiomatic semantics but only small ones in the other two forms. Non-determinism caused by unspecified evaluation order can usual... |

1309 | Monads for Functional Programming
- Wadler
- 1995
(Show Context)
Citation Context ...group expressions. All these details are hidden in the abstract syntax. 2 This description, although nave, is sufficient for the purpose of this paper. The notation used is similar to the one used in =-=[Wadl92]-=-, with the exception of the bind operator, which is denoted here ass. 3 The choice of the mathematical space used for domains is not very important for such a small language. Pointed cpo's are a reaso... |

473 |
Denotational Semantics: the Scott-Strachey Approach to Programming Languages Theory
- Stoy
- 1977
(Show Context)
Citation Context ...nce of side effects in expressions is a source of non-deterministic behaviour. The formal semantics of pure expressions can most of the times be easily specified in operational [Henn90], denotational =-=[Stoy77]-=- or axiomatic form [Dijk76]. The introduction of side-effects implies serious complications in the axiomatic semantics but only small ones in the other two forms. Non-determinism caused by unspecified... |

233 | Monad Transformers and Modular Interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context ...E 2 ]] = [[ E 1 ]]sM ( n: [[ E 2 ]]) where, apart from the details of M's implementation, we have yet to define operator ./ and functions update : (S ! S) ! M(S) and state : M(S). The last two, as in =-=[Lian95]-=-, are used as an interface between computations and the state. The implementation of update depends on monad M and the result of update f is a computation that modifies the state by applying function ... |

212 | A Powerdomain Construction
- Plotkin
- 1976
(Show Context)
Citation Context ...o replace P by a monad supporting multiple results. An obvious choice is the powerdomain monad, that is defined below using an appropriate powerdomain constructor such as Plotkin's convex powerdomain =-=[Plot76]-=-. Multiple results are constructed with the polymorphic operator \Delta [ P \Delta : P(A) \Theta P(A) ! P(A). 5 Left-to-right evaluation is used by many programming languages, such as Standard ML and ... |

165 |
An Abstract View of Programming Languages
- Moggi
- 1989
(Show Context)
Citation Context ...cks of classic denotational semantics is its lack of modularity. Small changes in a language's definition often imply a complete rewrite of its formal semantics. The use of category theory and monads =-=[Mogg90]-=- has been proposed as a remedy and has become quite popular in the denotational semantics community. Monad notation is used in this paper and it is demonstrated that, as a result, the semantics is sig... |

146 |
Component-Based Semantics
- Mosses
- 2009
(Show Context)
Citation Context ... The choice of the mathematical space used for domains is not very important for such a small language. Pointed cpo's are a reasonable option. The domain notation used in this paper is the same as in =-=[Moss90]-=-. N. The definition of M depends on our notion of computation and it is evident that, in the case of ELSE, computations may read and modify values of variables, i.e. the state. The result of unit M v ... |

84 | The Semantics of the C Programming Language
- Gurevich, Huggins
- 1992
(Show Context)
Citation Context ...rliest formal approach, Sethi addresses the semantics of pre-ANSI C, using the denotational approach and assuming left-to-right evaluation of expressions [Seth80]. In the work of Gurevich and Huggins =-=[Gure93]-=- a formal semantics for C is given in the form of evolving algebra. The semantics of evaluation order is based on the assumptions that no interleaving is possible in expression evaluation (i.e. nondet... |

74 |
The semantics of programming languages: an elementary introduction using structural operational semantics
- Hennessy
- 1990
(Show Context)
Citation Context ...ctly defined, the presence of side effects in expressions is a source of non-deterministic behaviour. The formal semantics of pure expressions can most of the times be easily specified in operational =-=[Henn90]-=-, denotational [Stoy77] or axiomatic form [Dijk76]. The introduction of side-effects implies serious complications in the axiomatic semantics but only small ones in the other two forms. Non-determinis... |

49 | Controlling Effects
- Filinski
- 1996
(Show Context)
Citation Context ...f evaluation order by 9 To reduce complexity in the figure, we keep the old notation instead of the newly defined state operations get and put. assuming left-to-right evaluation. The work of Filinski =-=[Fili96]-=- focuses on the introduction of various kinds of effects in functional languages, using appropriate monads for state and continuations, but does not address the issue of evaluation order semantics. Ev... |

21 |
Axiomatic approach to side effects and general jumps
- Kowaltowski
- 1977
(Show Context)
Citation Context ...he field of expression languages, side effects and evaluation order spans a wide area of interest. Among the earliest related publications we should mention the work of Boehm [Boeh82] and Kowaltowski =-=[Kowa77]-=- on the axiomatic semantics of expression languages with side effects. Both avoid the pitfall of evaluation order by 9 To reduce complexity in the figure, we keep the old notation instead of the newly... |

16 |
Path Analysis and the Optimization of Non-strict Functional Languages
- Bloss
- 1989
(Show Context)
Citation Context ...ons, but does not address the issue of evaluation order semantics. Evaluation order analysis in lazy functional languages is dealt with in the work of Draghicescu and Purushothaman [Drag90] and Bloss =-=[Blos94]-=-. Both do not define a semantics of execution for different evaluation strategies and are primarily interested in optimizations and the destructive update problem. The semantics of many popular progra... |

15 | Inference rules for programming languages with side effects in expressions
- Black, Windley
- 1996
(Show Context)
Citation Context ... Section 3.2 is used) and that side effects take place as they are generated. Both assumptions do not agree with the ANSI standard. A higher-level axiomatic semantics is proposed by Black and Windley =-=[Blac96]-=-, which removes side effects from expressions and treats them as separate statements. In the work of Cook and Subramanian [Cook94b] a semantics for C is developed in the theorem prover Nqthm. It emplo... |

15 | An abstract dynamic semantics for C
- Norrish
- 1997
(Show Context)
Citation Context ...f sequence points. To the best of our knowledge, the only semantics of ANSI C that correctly models unspecified order of evaluation, side effects and sequence points is defined in the work of Norrish =-=[Norr97]-=- in the form of operational semantics with small-step reductions. No similar denotational approach is known to us. 5 Conclusion and future work This paper was mainly concerned with exploring the seman... |

9 |
A Case Study in Specifying the Semantics of a Programming Language
- Sethi
- 1980
(Show Context)
Citation Context ... wide applications. In what seems to be the earliest formal approach, Sethi addresses the semantics of pre-ANSI C, using the denotational approach and assuming left-to-right evaluation of expressions =-=[Seth80]-=-. In the work of Gurevich and Huggins [Gure93] a formal semantics for C is given in the form of evolving algebra. The semantics of evaluation order is based on the assumptions that no interleaving is ... |

8 |
A formal denotational semantics for C
- Cook, Cohen, et al.
- 1994
(Show Context)
Citation Context ...der of side-effects, but this is not really used since the authors consider a subset of C with pure expressions. Cook et al. have also developed a denotational semantics for C based on temporal logic =-=[Cook94a]-=-. Although left-to-right evaluation is assumed in this work, the authors suggest how this can be remedied. However, it is not clear whether the suggestion allows for interleaving and there is no treat... |

8 |
A formal semantics for C in Nqthm
- Cook, Subramanian
- 1994
(Show Context)
Citation Context .... A higher-level axiomatic semantics is proposed by Black and Windley [Blac96], which removes side effects from expressions and treats them as separate statements. In the work of Cook and Subramanian =-=[Cook94b]-=- a semantics for C is developed in the theorem prover Nqthm. It employs an oracle for determining evaluation order and order of side-effects, but this is not really used since the authors consider a s... |

6 |
A Compositional Analysis of Evaluation-Order and its Application
- Draghicescu, Purushothaman
- 1990
(Show Context)
Citation Context ...tate and continuations, but does not address the issue of evaluation order semantics. Evaluation order analysis in lazy functional languages is dealt with in the work of Draghicescu and Purushothaman =-=[Drag90]-=- and Bloss [Blos94]. Both do not define a semantics of execution for different evaluation strategies and are primarily interested in optimizations and the destructive update problem. The semantics of ... |

5 |
A Logic for Expressions with Side Effects
- Boehm
- 1982
(Show Context)
Citation Context ...elated work Research in the field of expression languages, side effects and evaluation order spans a wide area of interest. Among the earliest related publications we should mention the work of Boehm =-=[Boeh82]-=- and Kowaltowski [Kowa77] on the axiomatic semantics of expression languages with side effects. Both avoid the pitfall of evaluation order by 9 To reduce complexity in the figure, we keep the old nota... |