Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-5wvtr Total loading time: 0 Render date: 2024-07-18T05:22:27.264Z Has data issue: false hasContentIssue false

Chapter 13 - Expressions

Published online by Cambridge University Press:  19 January 2010

Peter D. Mosses
Affiliation:
Aarhus Universitet, Denmark
Get access

Summary

  • Expressions include arithmetic and Boolean operations. Statements involving expressions include conditionals, while-loops, and guarded alternatives.

  • The semantic description of expressions and statements illustrates the use of the functional action notation introduced in Chapter 6.

  • Semantic entities are the same as for literals, although further operations on them are needed now.

Expressions in programming languages resemble mathematical terms. Syntactically, both expressions and terms are generally formed from literal constants, such as numerals, and variables, using mathematical operators, such as +. Semanticaily, both expressions and terms are evaluated to particular values.

There are, however, some distinctive differences between expressions and terms. Function calls in expressions may lead to divergence, whereas the application of a mathematical function in a term to arguments outside its domain of definition is merely undefined. Expression evaluation may even involve execution of statements. The notion of a program variable in an expression is quite different from that of a mathematical variable in a term, as explained in detail in Chapter 15. The order of evaluation of subexpressions in an expression may affect the value given—although in most programming languages, the order of evaluation is deliberately left implementation-dependent, which prevents program(mer)s from relying on any particular order. Whether or not a particular subexpression gets evaluated may also affect the outcome of the evaluation, and some expression constructs conditionally avoid the evaluation of particular subexpressions.

Type
Chapter
Information
Action Semantics , pp. 142 - 151
Publisher: Cambridge University Press
Print publication year: 1992

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Expressions
  • Peter D. Mosses, Aarhus Universitet, Denmark
  • Book: Action Semantics
  • Online publication: 19 January 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511569869.018
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Expressions
  • Peter D. Mosses, Aarhus Universitet, Denmark
  • Book: Action Semantics
  • Online publication: 19 January 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511569869.018
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Expressions
  • Peter D. Mosses, Aarhus Universitet, Denmark
  • Book: Action Semantics
  • Online publication: 19 January 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511569869.018
Available formats
×