Skip to main content

Programs as Data Objects

  • Chapter
  • First Online:
  • 2678 Accesses

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

Abstract

Many interesting programs take as input a program or a program and some other data. Three types of programs in particular use programs as input: compilers, interpreters, and specialisers, which are briefly explained in this chapter. In order to be able to write such programs in WHILE, we need to be able to treat other WHILE-programs as data. To achieve that, an encoding for abstract syntax trees of WHILE-programs as lists is presented. Such lists can in turn be represented as values in the datatype of WHILE.

How can we express and manipulate programs by another program?

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

Buying options

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

Learn about institutional subscriptions

Notes

  1. 1.

    Again, we make some simplifying assumptions here in the sense that we only have one datatype. We talk about untyped languages so it makes sense to have just one type.

  2. 2.

    One can use unary or binary representation of numbers actually, and in the following we may use one or the other, according to the task at hand.

Reference

  1. Jones, N.D.: Computability and Complexity: From a Programming Perspective. MIT Press, Cambridge (1997) (Also available online at http://www.diku.dk/~neil/Comp2book.html)

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). Programs as Data Objects. In: Limits of Computation. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-27889-6_6

Download citation

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

  • 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