To most of us interpreters feel quite magical in that they can take a string and execute that as meaningful code. Thorsten Ball, author of the fantastic book: Writing An Interpreter In Go lifts the bonnet on what happens inside the interpreter on the .tech podcast hosted by Form3’s Kevin Holditch.
Thorsten goes through the stages of interpreting and adds concrete examples of how each stage fits into the next.
Programming languages can be implemented in one of two ways: by building a compiler or by building an interpreter. An interpreter reads in your program and then executes it by telling the computer/CPU what to do. Examples of interpreted languages are Ruby, Python or Javascript.
Both compilers and intrepreters give you more expressiveness: write less code to do more! Most of us are used to writing in high level languages such as Go, C# etc. More expresiveness and abstraction give you more building blocks to build bigger programs.
The stages of an interpreter are:
By comparison, compilation results in an artifact that is executed later. An interpreter looks at your source code and then executes it as quickly as possible. The compiler is interested in making the code runtime as optimal as possible, without caring about the time between code writing and code execution.
If you enjoyed this episode and would like to be part of the podcast, then please fill in this form and we’ll be in touch. ✍️
Written by
Adelina is a polyglot engineer and developer relations professional, with a decade of technical experience at multiple startups in London. She started her career as a Java backend engineer, converted later to Go, and then transitioned to a full-time developer relations role. She has published multiple online courses about Go on the LinkedIn Learning platform, helping thousands of developers up-skill with Go. She has a passion for public speaking, having presented on cloud architectures at major European conferences. Adelina holds an MSc. Mathematical Modelling and Computing degree.
Here are some other resources you might find interesting:
Our podcast host tackles how, why and when you should move to Go with the help of Johan Brandhorst & Andy Kuszyk.
We are joined by Ashley Jeffs, creator of Benthos. Benthos is an Open Source stream aggregator written in Go, designed to bridge messages between different brokers. Ashley took the step to turn it into his full time work this year and discusses the advantages of using Golang to develop Benthos in.