# (How to Write a (Lisp) Interpreter (in Python))

DevFeed: [(How to Write a (Lisp) Interpreter (in Python))](<https://devfeed.tech/articles/how-to-write-a-lisp-interpreter-in-python-40572.md>)

Original publisher: [Read original article](<http://norvig.com/lispy.html>)

Published: 2010-09-30T00:00:00Z

Content type: tutorial

Language: en

Sources: [Peter Norvig](<https://devfeed.tech/sources/peter-norvig.md>)

Topics: [scheme](<https://devfeed.tech/topics/scheme.md>), [Lisp](<https://devfeed.tech/topics/lisp.md>), [Python](<https://devfeed.tech/topics/python.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [how-to](<https://devfeed.tech/tags/how-to.md>), [interpreter](<https://devfeed.tech/tags/interpreter.md>), [lisp](<https://devfeed.tech/tags/lisp.md>), [python](<https://devfeed.tech/tags/python.md>)

## AI overview

The excerpt shows how to build a small Scheme interpreter in Python, starting with tokenization and parsing expressions into nested lists, then evaluating numbers, variables, conditionals, definitions, and procedure calls against an environment of built-in operations. It extends the evaluator with `quote`, `set!`, and `lambda`; user procedures capture their defining environment, while nested environments resolve names outward according to lexical scoping. Examples demonstrate recursion, list operations, and higher-order procedures. The supplied text calls the implementation 90 lines in its summary, but its final line-count example reports 117 non-comment lines; the excerpt does not reconcile those figures. It also notes that the implementation omits minor Scheme details.

## Source excerpt

A Lisp interpreter in 90 lines of Python