Skip to content

Python: Writing a Compiler and Interpreter in 160 lines of code

jroller.com
23 pointsdavatk8 comments
On HN

Comments

Nice code, but that's not a compiler.

Indeed. And, given the "XX in less than YY lines of code" framing of the title, I was actually hoping for something a little more along the lines of clever code. This this is a pretty pedestrian interpreter, honestly. It's not bad code, just ... exactly what I would expect an interpreter for a tiny language to look like.

Agreed. It's a nice college freshman first project.

Hmm, a compiler it may not be, but I doubt many college freshmen could do this as a first project.

The final project for everyone in my intro course was to write a LISP interpreter. Have we fallen so far?

Terrific example for people that want to understand how interpreters work.

Not perfect. But perfect for getting your feet wet.

Wonder why comments are closed for the article?

probably spam

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.