Skip to main content

Semantics of WHILE

  • Chapter
  • First Online:
Limits of Computation

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 2691 Accesses

Abstract

If we want to take WHILE-programs as effective procedures we better make sure we understand exactly how to execute each command and ensure it can be executed using finite resources. Normally programs in high-level languages like WHILE are not directly executed on a machine like Turing machine programs are. They are interpreted by a special program, an interpreter, that can then be executed on any given computer’s hardware. We want to abstract away from all the details of hardware, but still ensure that WHILE-programs qualify as effective procedures, so in this chapter we assign WHILE a formal semantics that withstands any scrutiny. In order to describe the operational effect of commands we use relations involving stores that record current values of variables. The semantics of a WHILE-program is then its behaviour which describes the result of the program given any input.

What is the exact meaning of our programming language? Do its programs qualify as effective procedures?

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    “Imperative” here is to be understood literally, referring to “command” (as in “imperative mood”). This means that programs of an imperative language consist of commands.

  2. 2.

    In PHP, for instance, one writes array(key1=>value1,...,keyN=>valueN) or in Javascript array={’key1’: ’value1’,...,’keyN’:’valueN’} for such associative arrays.

  3. 3.

    See also Exercise 5.

References

  1. Cenciarelli, P., Knapp, A., Reus, B., Wirsing, M.: A structural operational semantics for multi-threaded Java. In Alves-Foss, J. (ed.) Formal Syntax and Semantics of Java. LNCS, vol. 1523, pp. 157–200. Springer (1999)

    Google Scholar 

  2. Fernández, M.: Programming Languages and Operational Semantics—A Concise Overview, UTiCS Series. Springer, Heidelberg (2014)

    Google Scholar 

  3. Streicher, T.: Domain-Theoretic Foundations of Functional Programming. World Scientific, Singapore (2006)

    Google Scholar 

  4. Winskel, G.: Formal Semantics of Programming Languages Paperback. MIT Press, Cambridge (1993)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bernhard Reus .

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Reus, B. (2016). Semantics of WHILE . In: Limits of Computation. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-27889-6_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-27889-6_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-27887-2

  • Online ISBN: 978-3-319-27889-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics