1. Introduction

The Mojo programming language was announced by the company Modular on May 2023. It was positioned as a language to build AI programs. However, the language they built was a much more powerful general purpose language. Mojo was from the start designed to be very close to Python, which was already entrenched deep in the domain of machine learning and AI. Python has over the many years built up a reputation of being one of the most easiest language for beginners to learn programming. Mojo having built up on the shoulders of this giant, offers an easy to use language with capabilities that challenge even the most powerful system languages such as C, C++ and Rust.

Mojo is built on top of MLIR, a reusable and extensible compiler infrastructure. This allowed team to benefit from multi-years of efforts already spent on MLIR. Mojo exposes ability to embed MLIR within its own programs, enabling much deeper optimizations. The design choices such as these allow Mojo to be used to build operating systems and device drivers where close interaction with hardware and high performance is necessary. The high level Python syntax, static and dynamic typing support, and the extensive Mojo standard library allows also developers to build enterprise software as easy as building a Python application. In effect, Mojo is able to support a very wide range of programming domains, ranging from operating systems up to enterprise Web applications.

Important notice

Mojo programming language is still under heavy development. Some of the chapters may get obsolete whenever there are changes to Mojo itself. Additionally, some chapters may seem incomplete, but that is because I am waiting for the implementation of that particular feature to be completed before I document it (e.g. Dictionary Literals). I try to keep track of the developments as close as possible and I try to update the book accordingly. However, I do have other commitments, and therefore may not get updated as fast I wish. Thanks for your patience.