Skip to main content

Translating Boolean Expressions

  • Chapter
  • 64 Accesses

Part of the book series: Macmillan Computer Science Series

Abstract

It’s possible to treat Boolean expressions in exactly the same way as arithmetic expressions — generate instructions to evaluate the subnodes, generate an instruction (or a sequence of instructions) to combine the Boolean values. Thus Boolean and and Boolean or operations can be translated using the TranBinOp procedure of chapter 5 with the machine instructions AND and OR. However Boolean expressions more often than not appear as the conditional test in an if or a while statement and, as a result, are used more as sections of program which select between alternative paths of computation than as algebraic expressions which compute a truth value. Most good compilers therefore try to generate ‘jumping’ code for Boolean expressions in these contexts. First of all, however, it is necessary to demonstrate the code fragments which are required when Boolean expressions are regarded as value-calculating mechanisms.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Copyright information

© 1979 Richard Bornat

About this chapter

Cite this chapter

Bornat, R. (1979). Translating Boolean Expressions. In: Understanding and Writing Compilers. Macmillan Computer Science Series. Palgrave, London. https://doi.org/10.1007/978-1-349-16178-2_7

Download citation

  • DOI: https://doi.org/10.1007/978-1-349-16178-2_7

  • Publisher Name: Palgrave, London

  • Print ISBN: 978-0-333-21732-0

  • Online ISBN: 978-1-349-16178-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics