Jacob Bumbuna



Building an Interpreter: Introduction

Building an Interpreter: Introduction

Jacob Bumbuna's photo
Jacob Bumbuna
·Nov 26, 2022·

3 min read

Table of contents

  • Functions of an interpreter
  • Stages of Interpretation
  • Series Roadmap
  • Series Goals
  • Stater pack
  • Resources
  • Interaction

As a general definition an interpreter(in computing) is a program that takes as input source code written in a higher language transforms it to an end product that it then executes and outputs whatever it is that the input code intended as output.

Functions of an interpreter

  • Convert and execute code written in a higher level programming language.
  • Mimic through software a processing unit.
  • Act as an intermediary between programs written in a high level language and the operating system.
  • Adds a layer of security and stability as potentially malicious code is not directly run on the computer's hardware.
  • Provide a rapid development environment as the duration from writing to execution of code is small as compared to building and running native applications.
  • Facilitate quick distribution of programs as code runs unchanged on different platforms and environments.

Stages of Interpretation

Before execution the source code undergoes several transformations which define the stages of interpretation.

Stage Input Output
Input System source code bytes character stream
Lexical Analysis character stream token stream
Syntax Analysis token stream Intermediate code
Execution Engine Intermediate code Program Output

From the above table it's easy to decipher that the a stage pipes its output to the next stage which in turn pipes its output to the next stage in the "chain". This design style enforces one of the main software design principles, Separation of concern as input into a stage is guaranteed to be free of errors as they would have caused termination at the preceding stages.

Series Roadmap

  • Simple interpreter as an example of how a fully fledged interpreter works.
  • Discussion and implementation of the Input Stage.
  • Discussion and implementation of the Lexical analysis Stage.
  • Discussion and implementation of the Syntax analysis Stage.
  • Discussion and implementation of the Execution engine Stage.
  • Tie things together.
  • Conclude the series.

Series Goals

  • By the end of this series we will have a fully fledged working interpreter for a language we will design later in the series.
  • You should have a better understanding of how interpreters work.
  • You should be able to apply the concepts learned here in other fields not necessarily related to interpreters.
  • Greater understanding and appreciation for the C language.
  • Finally, You should be able to design and develop your own interpreted language.

Stater pack

  • Unix Platform.
  • Understanding of the C language.
  • Knowledge of fundamental data structures i.e lists, maps etc.
  • Github Usage.*
  • CMake.*

NOTE: * Optional


  • The source code will be hosted here.
  • Coding videos will be hosted on Youtube (TBD).


Share this