# What is Lox?

> Lox is the small dynamic language you implement twice in Crafting Interpreters: closures, classes, inheritance, and a full test suite to check yourself.

**Lox**: Lox is a small, dynamically typed scripting language designed by Robert Nystrom for the book Crafting Interpreters, implemented twice in it: as jlox and as clox.

**Lox** is the programming language you build in Robert Nystrom's book Crafting Interpreters. It is small enough to implement in a book and real enough to be interesting: dynamic types, first-class functions, closures, classes and single inheritance.

## What Lox has

- Numbers (double precision), strings, booleans and `nil`
- Variables with block scope, `if`, `while` and `for`
- Functions as values, and closures that capture variables
- Classes with methods, `this`, initializers and single inheritance with `super`
- A `print` statement and a `clock()` native function

It leaves out arrays, maps and a standard library on purpose, so the book can spend its pages on how a language works, not on library code.

## Two implementations

The book implements Lox twice. [jlox](https://cracked.guide/glossary/jlox) is a [tree-walk interpreter](https://cracked.guide/glossary/tree-walk-interpreter) in Java. [clox](https://cracked.guide/glossary/clox) is a [bytecode virtual machine](https://cracked.guide/glossary/bytecode-vm) in C with its own hash table and garbage collector. Both pass the same test suite, which is how you know yours works: see [running the Lox test suite](https://cracked.guide/learn/lox-test-suite).

## Questions

### Is Lox used in production?

No. It is a teaching language. Its value is that you can understand and build every part of it.

### Where is the Lox language described?

Chapter 3 of Crafting Interpreters, "The Lox Language", free at craftinginterpreters.com.

---

Source: https://cracked.guide/glossary/lox
cracked.guide: A free, dated 145-week path to getting genuinely cracked at programming.
