# Welcome

Welcome to the official documentation for the Lox2 programming language—a superset of the [original Lox toy language](https://github.com/munificent/craftinginterpreters) featuring a multi-pass compiler, optional type checker, and numerous new features. Lox2 is open source and designed for educational purposes; its source code is available on GitHub and is structured for readability, making it accessible for anyone interested in compiler implementation. In addition to its educational value, Lox2 is production-ready, enabling developers to build robust applications using its advanced features and comprehensive standard library.

<a href="https://github.com/HallofFamer/CLox" class="button primary">View on Github</a>

The following example demonstrates how to send a simple asynchronous HTTP request, print the response to the console, and throw an exception if the request fails. This code sample utilizes several Lox2 features, including namespace declaration and import, immutable variable declaration, async/await, string interpolation, and exception handling:

```typescript
namespace Lox2Example
using clox.std.net.HTTPClient
using clox.std.net.URL

val client = HTTPClient()
val response = await client.getAsync(URL.parse("https://example.com"))

if (response.status != 200) {
    throw Exception("HTTP error! Status: ${response.status}")
}

println("Content: ${response.content}")
client.close()
```

### Jump right in

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Getting Started</strong></td><td>Getting started with Lox2</td><td></td><td></td><td><a href="getting-started">getting-started</a></td></tr><tr><td><strong>Basics</strong></td><td>Learn the basics of the Lox2 language</td><td></td><td></td><td><a href="basics">basics</a></td></tr><tr><td><strong>Advanced Concepts</strong></td><td>Explore advanced features provided in Lox2</td><td></td><td></td><td><a href="advanced-concepts">advanced-concepts</a></td></tr><tr><td><strong>Examples</strong></td><td>Example programs written in Lox2</td><td></td><td></td><td><a href="examples">examples</a></td></tr><tr><td><strong>Standard Library</strong></td><td>References for Lox2's rich standard library</td><td></td><td></td><td><a href="standard-library">standard-library</a></td></tr></tbody></table>
