9.5 Procedures and Function Calls

Functions are an important and widespread abstraction mechanism in many different programming languages. A function is a first step to reusable code. A function name carries its returned value. A procedure is a function that does not return any useful value via its name, and it is used for its side effects only. We now discuss the implementation of functions and the kind of data structures we require to implement them.

There are a wide range of different design choices:

  • What are the types of arguments that can be passed as parameters or returned as results?
  • Do we allow variable number of arguments?
  • Do we allow recursion in functions?
  • Do we allow nested functions?
  • Can functions have side effects?

Various languages ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.