Users without a subscription are not able to see the full content.

## Douglas Schenck and Peter Wilson

Print publication date: 1994

Print ISBN-13: 9780195087147

Published to Oxford Scholarship Online: November 2020

DOI: 10.1093/oso/9780195087147.001.0001

Show Summary Details
Page of

PRINTED FROM OXFORD SCHOLARSHIP ONLINE (oxford.universitypressscholarship.com). (c) Copyright Oxford University Press, 2021. All Rights Reserved. An individual user may print out a PDF of a single chapter of a monograph in OSO for personal use. date: 13 June 2021

# Expressions

Chapter:
Chapter 14 Expressions
Source:
Information Modeling: The EXPRESS Way
Publisher:
Oxford University Press
DOI:10.1093/oso/9780195087147.003.0022

Expressions are combinations of operators and operands which are evaluated to produce a value of a specific type. Infix operators require two operands with an operator written between them. A prefix operator requires one operand with an operator written before it. (The expression syntax starts on page 208.) Evaluation proceeds from left to right, governed by the precedence of the operators. The lowest numbered precedence as shown in Table 14.1 is evaluated first. Operators in the same row have the same precedence. Expressions enclosed by parentheses are evaluated before being treated as a single operand. An operand between two operators of different precedence is bound to the operator with the higher one; e.g., −10*20 means (−10)*20. An operand between two operators of the same precedence is bound to the one on the left; e.g., 10/20 * 30 means (10/20) * 30. Exercise 14.1 Work out the intermediate steps for this expression: … −2/(4+4)*5+6… When a null value is encountered in an expression where a non-null is expected, evaluation is short circuited and a null answer is produced. Otherwise, all expressions are fully evaluated even when the outcome is known after partial evaluation. Exercise 14.2 Can you think of an expression that does not require complete evaluation to get the correct answer? The operands of an operator must be compatible with the operator and with each other. Operands can be compatible without having identical types and are compatible when any of these conditions are satisfied: • The types are the same. • One type is a subtype of the other (e.g., one is a number and the other is an integer. • Both types are strings. • Both types are binaries. • Both types are arrays which have compatible base types and identical bounds. • Both types are bags which have compatible base types. • Both types are lists which have compatible base types. • Both types are sets which have compatible base types. Operations are organized by the kind of result they produce, namely: numeric, boolean or logical, string or binary, or aggregate.

Oxford Scholarship Online requires a subscription or purchase to access the full text of books within the service. Public users can however freely search the site and view the abstracts and keywords for each book and chapter.