Intermediate-Code Generation

  • Torben Ægidius Mogensen
Part of the Undergraduate Topics in Computer Science book series (UTICS)


The final goal of a compiler is to get programs written in a high-level language to run on a computer. This means that, eventually, the program will have to be expressed as machine code which can run on the computer. This does not mean that we need to translate directly from the high-level abstract syntax to machine code. Many compilers use a medium-level language as a stepping-stone between the high-level language and the very low-level machine code. Such stepping-stone languages are called intermediate code. We will generate intermediate code using translation functions for each syntactic category, similar to the functions we used for interpretation and type checking. We generate code for a syntactic construct independently of the constructs around it, except that the parameters of a translation function may hold information about the context (such as symbol tables) and the result of a translation function may (in addition to the generated code) hold information about how the generated code interfaces with its context (such as which variables it uses).


Array Element Expression Language Machine Code Translation Function Base Address 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Aït-Kaci, H.: Warren’s Abstract Machine—A Tutorial Reconstruction. MIT Press, Cambridge (1991) Google Scholar
  2. 2.
    Appel, A.W.: Compiling with Continuations. Cambridge University Press, Cambridge (1992) Google Scholar
  3. 3.
    Jones, S.L.P., Lester, D.: Implementing Functional Languages—A Tutorial. Prentice Hall, Reading (1992) Google Scholar
  4. 4.
    Lattner, C.: Llvm language reference manual (2011).
  5. 5.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley, Reading (1999) Google Scholar
  6. 6.
    Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Mateo (1997) Google Scholar

Copyright information

© Springer-Verlag London Limited 2011

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of CopenhagenCopenhagenDenmark

Personalised recommendations