Micro language implementation: Calcium

Lobsters Hottest Tools

Summary

A blog post about Calcium, a tiny programming language implementation designed to demonstrate how languages like Python are compiled and executed, created by Ned Batchelder to explain the compiled vs. interpreted debate.

<p><a href="https://lobste.rs/s/iii8sl/micro_language_implementation_calcium">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 08/24/26, 03:32 PM

# Micro language implementation: Calcium Source: [https://nedbatchelder.com/blog/202608/micro_language_implementation_calcium](https://nedbatchelder.com/blog/202608/micro_language_implementation_calcium) [Saturday 22](https://nedbatchelder.com/blog/date/0822)[August 2026](https://nedbatchelder.com/blog/2026#month202608) A tiny language, to explain how programming languages are implemented\. I wrote a tiny language implementation:[Calcium](https://github.com/nedbat/calcium)\. It’s meant as a demonstration of how languages like Python are implemented\. It has a tokenizer, a parser, an AST, a compiler, bytecodes, and an execution engine, all in about 300 lines of code\. I did it because I often see the question: isn’t Python interpreted? Why do people say it’s compiled? \(BTW, I also answered this in an earlier blog post:[Is Python interpreted or compiled? Yes\.](https://nedbatchelder.com/blog/201803/is_python_interpreted_or_compiled_yes)\) It can be hard to explain that your Python program never becomes an explicit sequence of native CPU instructions, which is what people often think “compiled” means\. So I coded up[Calcium](https://github.com/nedbat/calcium)to have on hand the next time it comes up\. I think it will help to be able to show the execution engine code reading bytecodes and doing what they say\. It could also be an interesting starting point for people wanting to play with a language implementation\. It has almost nothing, so there’s lots of simple things \(comments?\) to add\.

Similar Articles