Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.4 KB

README.md

File metadata and controls

26 lines (18 loc) · 1.4 KB

Introduction

The goal of this tutorial is to provide the foundation for an interpreter in Swift that is simple enough to understand, yet substantial enough to continue building upon and playing around with; the final implementation weighs in at 1.5 kloc.

A taste of interpreters, Swift, or both; depending on where you're coming from.

Rather than starting with parsing; we'll work from the bottom up, starting with a basic virtual machine and gradually adding syntax and features on top.

Motivation

I consider learning how our tools are constructed essential.

In addition, compilers/interpreters are useful in many situations; configuration languages, expression evaluators, template engines and scripting languages just to name a few.

Parts

  1. A minimum viable virtual machine

  2. Tracing and green threads

  3. Namespaces, forms and macros

  4. User defined functions

  5. Readers and REPL

  6. Two flavors of Fibonacci

  7. Benchmarking and optimization