Interpreter for the Karp programming language
Every interpreter is built to interpret a specific programming language. That’s how you “implement” a programming language. Without a compiler or an interpreter a programming language is nothing more than an idea or a specification.
We’re going to parse and evaluate our own language called Karp. It’s a language specifically designed for this book.
- REPL
Expressed as a list of features, Karp has the following:
- C-like syntax
- variable bindings
- integers and booleans
- arithmetic expressions
- built-in functions
- first-class and higher-order functions
- closures
- a string data structure
- an array data structure
- a hash data structure
Why is it called “Karp”? Well, because karps are magnificent, elegant, fascinating and funny creatures. Exactly like our interpreter
What can be said is that the one fundamental attribute they all share is that they take source code and evaluate it without producing some visible, intermediate result that can later be executed. That’s in contrast to compilers, which take source code and produce output in another language that the underlying system can understand.
The interpreter gives them meaning!