Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

(How to Write a (Lisp) Interpreter (In Python))

Peter Norvig presents a step-by-step tutorial on writing a Lisp interpreter in Python, covering the core components of a language interpreter: a parser that converts source code into abstract syntax trees, and an evaluator that executes those trees. The article demonstrates the minimal elegance of Lisp by showing how its computational model can be implemented in a few hundred lines of Python.

Background

Peter Norvig is a renowned computer scientist and director of research at Google, known for his work in AI and programming language design. This article teaches how to write a Lisp interpreter (a program that runs Lisp code) using Python. Lisp is one of the oldest programming languages (created in 1958), famous for its minimalist syntax of nested parentheses (S-expressions) and its metaprogramming power. The article is a classic tutorial that demonstrates core computer science concepts: parsing (turning text into data structures), evaluation (running parsed code), and the beauty of a language that can represent its own programs as simple lists. It matters because building an interpreter from scratch is considered a rite of passage that deeply demystifies how programming languages work — and Norvig's version is especially accessible to Python programmers.