{"slug": "micro-language-implementation-calcium", "title": "Micro language implementation: Calcium", "summary": "Ned Batchelder released Calcium, a 300-line language implementation on GitHub that demonstrates how Python-like languages are tokenized, parsed, compiled into bytecodes, and executed, aiming to clarify why Python is both interpreted and compiled.", "body_md": "A tiny language, to explain how programming languages are implemented.\n\nI wrote a tiny language implementation: [Calcium](https://github.com/nedbat/calcium).\nIt’s meant as a demonstration of how languages like Python are implemented. It\nhas a tokenizer, a parser, an AST, a compiler, bytecodes, and an execution\nengine, all in about 300 lines of code.\n\nI did it because I often see the question: isn’t Python interpreted? Why do\npeople say it’s compiled? (BTW, I also answered this in an earlier blog post:\n[Is Python interpreted or compiled? Yes.](//nedbatchelder.com/blog/201803/is_python_interpreted_or_compiled_yes)) It can be hard to explain\nthat your Python program never becomes an explicit sequence of native CPU\ninstructions, which is what people often think “compiled” means.\n\nSo I coded up [Calcium](https://github.com/nedbat/calcium) to have on hand the next time\nit comes up. I think it will help to be able to show the execution engine code\nreading bytecodes and doing what they say.\n\nIt 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.", "url": "https://wpnews.pro/news/micro-language-implementation-calcium", "canonical_source": "https://nedbatchelder.com/blog/202608/micro_language_implementation_calcium", "published_at": "2026-08-24 13:56:40+00:00", "updated_at": "2026-08-24 15:13:15.722842+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Ned Batchelder", "Calcium", "GitHub", "Python"], "alternates": {"html": "https://wpnews.pro/news/micro-language-implementation-calcium", "markdown": "https://wpnews.pro/news/micro-language-implementation-calcium.md", "text": "https://wpnews.pro/news/micro-language-implementation-calcium.txt", "jsonld": "https://wpnews.pro/news/micro-language-implementation-calcium.jsonld"}}