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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 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.
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
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)
Author information
Authors and Affiliations
Corresponding author
Rights 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)