Welcome to the official documentation for the Lox2 programming language—a superset of the original Lox toy language 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.
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: