Skip to content

codr7/swift-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Build an interpreter in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages