Micro language implementation: Calcium
I have developed a small programming language called Calcium. This language exemplifies the inner workings of languages similar to Python. The Calcium language incorporates key features such as a tokenizer, parser, abstract syntax tree (AST), compiler, bytecodes, and an execution engine, all contained within approximately 300 lines of code.
My motivation behind this project stems from frequently encountering the query: "Isn't Python interpreted? Why do people claim it's compiled?" (For reference, I have previously addressed this topic in my blog post: "Is Python interpreted or compiled? Yes.") To effectively communicate that Python programs do not transform into explicit sequences of native CPU instructions, a common misconception associated with the term "compiled," I created Calcium.
This implementation serves as a valuable reference when this question arises in the future. Additionally, Calcium can serve as an intriguing starting point for individuals interested in experimenting with language implementations. Its simplicity allows for easy modification and enhancement, offering a wealth of opportunities to add more functionalities and improve upon the existing design.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.